Bug 1336986 - Return false in ContainsOnlyColoredGlyphs if no glyphs are drawing. r=jrmuizel
If font is downloading, we don't draw any glyphs in drawtarget which
means mDrawCommandsStorage doesn't contain any FILLGLYPHS command.
Return false in this situation so that we can handle it correctly in the
caller.
MozReview-Commit-ID: CtxvCeYh0ii
--- a/gfx/2d/DrawTargetCapture.cpp
+++ b/gfx/2d/DrawTargetCapture.cpp
@@ -199,16 +199,17 @@ DrawTargetCaptureImpl::ReplayToDrawTarge
bool
DrawTargetCaptureImpl::ContainsOnlyColoredGlyphs(RefPtr<ScaledFont>& aScaledFont,
Color& aColor,
std::vector<Glyph>& aGlyphs)
{
uint8_t* start = &mDrawCommandStorage.front();
uint8_t* current = start;
+ bool result = false;
while (current < start + mDrawCommandStorage.size()) {
DrawingCommand* command =
reinterpret_cast<DrawingCommand*>(current + sizeof(uint32_t));
current += *(uint32_t*)current;
if (command->GetType() != CommandType::FILLGLYPHS &&
command->GetType() != CommandType::SETTRANSFORM) {
@@ -246,14 +247,15 @@ DrawTargetCaptureImpl::ContainsOnlyColor
return false;
}
//TODO: Deal with AA on the DrawOptions, and the GlyphRenderingOptions
aGlyphs.insert(aGlyphs.end(),
fillGlyphs->mGlyphs.begin(),
fillGlyphs->mGlyphs.end());
+ result = true;
}
- return true;
+ return result;
}
} // namespace gfx
} // namespace mozilla