summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
authorvmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-08 05:25:34 +0000
committervmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-08 05:25:34 +0000
commit5314d0d9f8764e6fbff8e7519fd94f52cef6aa75 (patch)
tree39fed63f533378a7a61ed7590bfd30a3b1722bca /skia
parente5280667f958ab33c00d50511f275f05d362d962 (diff)
downloadchromium_src-5314d0d9f8764e6fbff8e7519fd94f52cef6aa75.zip
chromium_src-5314d0d9f8764e6fbff8e7519fd94f52cef6aa75.tar.gz
chromium_src-5314d0d9f8764e6fbff8e7519fd94f52cef6aa75.tar.bz2
Skia/ext analysis canvas style change
Changed the style of skia/ext to be Chromium style. BUG=245787 Review URL: https://chromiumcodereview.appspot.com/16647003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205032 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r--skia/ext/analysis_canvas.cc448
-rw-r--r--skia/ext/analysis_canvas.h144
-rw-r--r--skia/ext/analysis_canvas_unittest.cc144
3 files changed, 392 insertions, 344 deletions
diff --git a/skia/ext/analysis_canvas.cc b/skia/ext/analysis_canvas.cc
index 272568e..6c3f5ca 100644
--- a/skia/ext/analysis_canvas.cc
+++ b/skia/ext/analysis_canvas.cc
@@ -13,12 +13,14 @@
namespace {
-bool isSolidColorPaint(const SkPaint& paint) {
- SkXfermode::Mode xferMode;
+const int kNoLayer = -1;
+
+bool IsSolidColorPaint(const SkPaint& paint) {
+ SkXfermode::Mode xfermode;
// getXfermode can return a NULL, but that is handled
// gracefully by AsMode (NULL turns into kSrcOver mode).
- SkXfermode::AsMode(paint.getXfermode(), &xferMode);
+ SkXfermode::AsMode(paint.getXfermode(), &xfermode);
// Paint is solid color if the following holds:
// - Alpha is 1.0, style is fill, and there are no special effects
@@ -30,24 +32,24 @@ bool isSolidColorPaint(const SkPaint& paint) {
!paint.getMaskFilter() &&
!paint.getColorFilter() &&
paint.getStyle() == SkPaint::kFill_Style &&
- (xferMode == SkXfermode::kSrc_Mode ||
- xferMode == SkXfermode::kSrcOver_Mode));
+ (xfermode == SkXfermode::kSrc_Mode ||
+ xfermode == SkXfermode::kSrcOver_Mode));
}
-bool isFullQuad(const SkDraw& draw,
- const SkRect& canvasRect,
- const SkRect& drawnRect) {
+bool IsFullQuad(const SkDraw& draw,
+ const SkRect& canvas_rect,
+ const SkRect& drawn_rect) {
// If the transform results in a non-axis aligned
// rect, then be conservative and return false.
if (!draw.fMatrix->rectStaysRect())
return false;
- SkRect drawBitmapRect;
- draw.fBitmap->getBounds(&drawBitmapRect);
- SkRect clipRect = SkRect::Make(draw.fRC->getBounds());
- SkRect deviceRect;
- draw.fMatrix->mapRect(&deviceRect, drawnRect);
+ SkRect draw_bitmap_rect;
+ draw.fBitmap->getBounds(&draw_bitmap_rect);
+ SkRect clip_rect = SkRect::Make(draw.fRC->getBounds());
+ SkRect device_rect;
+ draw.fMatrix->mapRect(&device_rect, drawn_rect);
// The drawn rect covers the full canvas, if the following conditions hold:
// - Clip rect is an actual rectangle.
@@ -58,88 +60,87 @@ bool isFullQuad(const SkDraw& draw,
// - The bitmap into which the draw call happens is at least as
// big as the canvas rect
return draw.fRC->isRect() &&
- deviceRect.contains(clipRect) &&
- clipRect.contains(canvasRect) &&
- drawBitmapRect.contains(canvasRect);
+ device_rect.contains(clip_rect) &&
+ clip_rect.contains(canvas_rect) &&
+ draw_bitmap_rect.contains(canvas_rect);
}
} // namespace
namespace skia {
-AnalysisDevice::AnalysisDevice(const SkBitmap& bm)
- : INHERITED(bm)
- , isForcedNotSolid_(false)
- , isForcedNotTransparent_(false)
- , isSolidColor_(true)
- , isTransparent_(true)
- , hasText_(false) {
-}
+AnalysisDevice::AnalysisDevice(const SkBitmap& bitmap)
+ : INHERITED(bitmap),
+ is_forced_not_solid_(false),
+ is_forced_not_transparent_(false),
+ is_solid_color_(true),
+ is_transparent_(true),
+ has_text_(false) {}
-AnalysisDevice::~AnalysisDevice() {
-}
+AnalysisDevice::~AnalysisDevice() {}
-bool AnalysisDevice::getColorIfSolid(SkColor* color) const {
- if (isTransparent_) {
+bool AnalysisDevice::GetColorIfSolid(SkColor* color) const {
+ if (is_transparent_) {
*color = SK_ColorTRANSPARENT;
return true;
}
- if (isSolidColor_) {
+ if (is_solid_color_) {
*color = color_;
return true;
}
return false;
}
-bool AnalysisDevice::hasText() const {
- return hasText_;
+bool AnalysisDevice::HasText() const {
+ return has_text_;
}
-void AnalysisDevice::setForceNotSolid(bool flag) {
- isForcedNotSolid_ = flag;
- if (isForcedNotSolid_)
- isSolidColor_ = false;
+void AnalysisDevice::SetForceNotSolid(bool flag) {
+ is_forced_not_solid_ = flag;
+ if (is_forced_not_solid_)
+ is_solid_color_ = false;
}
-void AnalysisDevice::setForceNotTransparent(bool flag) {
- isForcedNotTransparent_ = flag;
- if (isForcedNotTransparent_)
- isTransparent_ = false;
+void AnalysisDevice::SetForceNotTransparent(bool flag) {
+ is_forced_not_transparent_ = flag;
+ if (is_forced_not_transparent_)
+ is_transparent_ = false;
}
void AnalysisDevice::clear(SkColor color) {
- isTransparent_ = (!isForcedNotTransparent_ && SkColorGetA(color) == 0);
- hasText_ = false;
+ is_transparent_ = (!is_forced_not_transparent_ && SkColorGetA(color) == 0);
+ has_text_ = false;
- if (!isForcedNotSolid_ && SkColorGetA(color) == 255) {
- isSolidColor_ = true;
+ if (!is_forced_not_solid_ && SkColorGetA(color) == 255) {
+ is_solid_color_ = true;
color_ = color;
- }
- else {
- isSolidColor_ = false;
+ } else {
+ is_solid_color_ = false;
}
}
-void AnalysisDevice::drawPaint(const SkDraw&, const SkPaint& paint) {
- isSolidColor_ = false;
- isTransparent_ = false;
+void AnalysisDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
+ is_solid_color_ = false;
+ is_transparent_ = false;
}
-void AnalysisDevice::drawPoints(const SkDraw&, SkCanvas::PointMode mode,
- size_t count, const SkPoint[],
- const SkPaint& paint) {
- isSolidColor_ = false;
- isTransparent_ = false;
+void AnalysisDevice::drawPoints(const SkDraw& draw,
+ SkCanvas::PointMode mode,
+ size_t count,
+ const SkPoint points[],
+ const SkPaint& paint) {
+ is_solid_color_ = false;
+ is_transparent_ = false;
}
-void AnalysisDevice::drawRect(const SkDraw& draw, const SkRect& rect,
- const SkPaint& paint) {
- bool doesCoverCanvas = isFullQuad(draw,
- SkRect::MakeWH(width(), height()),
- rect);
+void AnalysisDevice::drawRect(const SkDraw& draw,
+ const SkRect& rect,
+ const SkPaint& paint) {
+ bool does_cover_canvas =
+ IsFullQuad(draw, SkRect::MakeWH(width(), height()), rect);
- SkXfermode::Mode xferMode;
- SkXfermode::AsMode(paint.getXfermode(), &xferMode);
+ SkXfermode::Mode xfermode;
+ SkXfermode::AsMode(paint.getXfermode(), &xfermode);
// This canvas will become transparent if the following holds:
// - The quad is a full tile quad
@@ -150,15 +151,13 @@ void AnalysisDevice::drawRect(const SkDraw& draw, const SkRect& rect,
// not src, then this canvas will not be transparent.
//
// In all other cases, we keep the current transparent value
- if (doesCoverCanvas &&
- !isForcedNotTransparent_ &&
- xferMode == SkXfermode::kClear_Mode) {
- isTransparent_ = true;
- hasText_ = false;
- }
- else if (paint.getAlpha() != 0 ||
- xferMode != SkXfermode::kSrc_Mode) {
- isTransparent_ = false;
+ if (does_cover_canvas &&
+ !is_forced_not_transparent_ &&
+ xfermode == SkXfermode::kClear_Mode) {
+ is_transparent_ = true;
+ has_text_ = false;
+ } else if (paint.getAlpha() != 0 || xfermode != SkXfermode::kSrc_Mode) {
+ is_transparent_ = false;
}
// This bitmap is solid if and only if the following holds.
@@ -166,204 +165,222 @@ void AnalysisDevice::drawRect(const SkDraw& draw, const SkRect& rect,
// - We're not in "forced not solid" mode
// - Paint is solid color
// - The quad is a full tile quad
- if (!isForcedNotSolid_ &&
- isSolidColorPaint(paint) &&
- doesCoverCanvas) {
- isSolidColor_ = true;
+ if (!is_forced_not_solid_ && IsSolidColorPaint(paint) && does_cover_canvas) {
+ is_solid_color_ = true;
color_ = paint.getColor();
- hasText_ = false;
+ has_text_ = false;
+ } else {
+ is_solid_color_ = false;
}
- else {
- isSolidColor_ = false;
- }
-}
-
-void AnalysisDevice::drawOval(const SkDraw&, const SkRect& oval,
- const SkPaint& paint) {
- isSolidColor_ = false;
- isTransparent_ = false;
-}
-
-void AnalysisDevice::drawPath(const SkDraw&, const SkPath& path,
- const SkPaint& paint,
- const SkMatrix* prePathMatrix,
- bool pathIsMutable ) {
- isSolidColor_ = false;
- isTransparent_ = false;
-}
-
-void AnalysisDevice::drawBitmap(const SkDraw&, const SkBitmap& bitmap,
- const SkIRect* srcRectOrNull,
- const SkMatrix& matrix, const SkPaint& paint) {
- isSolidColor_ = false;
- isTransparent_ = false;
-}
-
-void AnalysisDevice::drawSprite(const SkDraw&, const SkBitmap& bitmap,
- int x, int y, const SkPaint& paint) {
- isSolidColor_ = false;
- isTransparent_ = false;
}
-void AnalysisDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
- const SkRect* srcOrNull, const SkRect& dst,
+void AnalysisDevice::drawOval(const SkDraw& draw,
+ const SkRect& oval,
const SkPaint& paint) {
+ is_solid_color_ = false;
+ is_transparent_ = false;
+}
+
+void AnalysisDevice::drawPath(const SkDraw& draw,
+ const SkPath& path,
+ const SkPaint& paint,
+ const SkMatrix* pre_path_matrix,
+ bool path_is_mutable) {
+ is_solid_color_ = false;
+ is_transparent_ = false;
+}
+
+void AnalysisDevice::drawBitmap(const SkDraw& draw,
+ const SkBitmap& bitmap,
+ const SkIRect* src_rect_or_null,
+ const SkMatrix& matrix,
+ const SkPaint& paint) {
+ is_solid_color_ = false;
+ is_transparent_ = false;
+}
+
+void AnalysisDevice::drawSprite(const SkDraw& draw,
+ const SkBitmap& bitmap,
+ int x,
+ int y,
+ const SkPaint& paint) {
+ is_solid_color_ = false;
+ is_transparent_ = false;
+}
+
+void AnalysisDevice::drawBitmapRect(const SkDraw& draw,
+ const SkBitmap& bitmap,
+ const SkRect* src_or_null,
+ const SkRect& dst,
+ const SkPaint& paint) {
// Call drawRect to determine transparency,
// but reset solid color to false.
drawRect(draw, dst, paint);
- isSolidColor_ = false;
+ is_solid_color_ = false;
}
-
-void AnalysisDevice::drawText(const SkDraw&, const void* text, size_t len,
- SkScalar x, SkScalar y, const SkPaint& paint) {
- isSolidColor_ = false;
- isTransparent_ = false;
- hasText_ = true;
-}
-
-void AnalysisDevice::drawPosText(const SkDraw& draw, const void* text,
- size_t len,
- const SkScalar pos[], SkScalar constY,
- int scalarsPerPos, const SkPaint& paint) {
- isSolidColor_ = false;
- isTransparent_ = false;
- hasText_ = true;
-}
-
-void AnalysisDevice::drawTextOnPath(const SkDraw&, const void* text,
+void AnalysisDevice::drawText(const SkDraw& draw,
+ const void* text,
size_t len,
- const SkPath& path, const SkMatrix* matrix,
+ SkScalar x,
+ SkScalar y,
const SkPaint& paint) {
- isSolidColor_ = false;
- isTransparent_ = false;
- hasText_ = true;
+ is_solid_color_ = false;
+ is_transparent_ = false;
+ has_text_ = true;
}
-#ifdef SK_BUILD_FOR_ANDROID
-void AnalysisDevice::drawPosTextOnPath(const SkDraw& draw, const void* text,
+void AnalysisDevice::drawPosText(const SkDraw& draw,
+ const void* text,
size_t len,
- const SkPoint pos[], const SkPaint& paint,
- const SkPath& path, const SkMatrix* matrix) {
- isSolidColor_ = false;
- isTransparent_ = false;
- hasText_ = true;
+ const SkScalar pos[],
+ SkScalar const_y,
+ int scalars_per_pos,
+ const SkPaint& paint) {
+ is_solid_color_ = false;
+ is_transparent_ = false;
+ has_text_ = true;
+}
+
+void AnalysisDevice::drawTextOnPath(const SkDraw& draw,
+ const void* text,
+ size_t len,
+ const SkPath& path,
+ const SkMatrix* matrix,
+ const SkPaint& paint) {
+ is_solid_color_ = false;
+ is_transparent_ = false;
+ has_text_ = true;
}
-#endif
-void AnalysisDevice::drawVertices(const SkDraw&, SkCanvas::VertexMode,
- int vertexCount,
- const SkPoint verts[], const SkPoint texs[],
- const SkColor colors[], SkXfermode* xmode,
- const uint16_t indices[], int indexCount,
- const SkPaint& paint) {
- isSolidColor_ = false;
- isTransparent_ = false;
+#ifdef SK_BUILD_FOR_ANDROID
+void AnalysisDevice::drawPosTextOnPath(const SkDraw& draw,
+ const void* text,
+ size_t len,
+ const SkPoint pos[],
+ const SkPaint& paint,
+ const SkPath& path,
+ const SkMatrix* matrix) {
+ is_solid_color_ = false;
+ is_transparent_ = false;
+ has_text_ = true;
}
+#endif
-void AnalysisDevice::drawDevice(const SkDraw&, SkDevice*, int x, int y,
- const SkPaint& paint) {
- isSolidColor_ = false;
- isTransparent_ = false;
+void AnalysisDevice::drawVertices(const SkDraw& draw,
+ SkCanvas::VertexMode,
+ int vertex_count,
+ const SkPoint verts[],
+ const SkPoint texs[],
+ const SkColor colors[],
+ SkXfermode* xmode,
+ const uint16_t indices[],
+ int index_count,
+ const SkPaint& paint) {
+ is_solid_color_ = false;
+ is_transparent_ = false;
+}
+
+void AnalysisDevice::drawDevice(const SkDraw& draw,
+ SkDevice* device,
+ int x,
+ int y,
+ const SkPaint& paint) {
+ is_solid_color_ = false;
+ is_transparent_ = false;
}
-
-const int AnalysisCanvas::kNoLayer = -1;
-
AnalysisCanvas::AnalysisCanvas(AnalysisDevice* device)
- : INHERITED(device)
- , savedStackSize_(0)
- , forceNotSolidStackLevel_(kNoLayer)
- , forceNotTransparentStackLevel_(kNoLayer) {
-}
-
-AnalysisCanvas::~AnalysisCanvas() {
-}
+ : INHERITED(device),
+ saved_stack_size_(0),
+ force_not_solid_stack_level_(kNoLayer),
+ force_not_transparent_stack_level_(kNoLayer) {}
+AnalysisCanvas::~AnalysisCanvas() {}
-bool AnalysisCanvas::getColorIfSolid(SkColor* color) const {
- return (static_cast<AnalysisDevice*>(getDevice()))->getColorIfSolid(color);
+bool AnalysisCanvas::GetColorIfSolid(SkColor* color) const {
+ return (static_cast<AnalysisDevice*>(getDevice()))->GetColorIfSolid(color);
}
-bool AnalysisCanvas::hasText() const {
- return (static_cast<AnalysisDevice*>(getDevice()))->hasText();
+bool AnalysisCanvas::HasText() const {
+ return (static_cast<AnalysisDevice*>(getDevice()))->HasText();
}
bool AnalysisCanvas::abortDrawing() {
// Early out as soon as we have detected that the tile has text.
- return hasText();
+ return HasText();
}
-bool AnalysisCanvas::clipRect(const SkRect& rect, SkRegion::Op op,
- bool doAA) {
- return INHERITED::clipRect(rect, op, doAA);
+bool AnalysisCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool do_aa) {
+ return INHERITED::clipRect(rect, op, do_aa);
}
-bool AnalysisCanvas::clipPath(const SkPath& path, SkRegion::Op op,
- bool doAA) {
- // clipPaths can make our calls to isFullQuad invalid (ie have false
+bool AnalysisCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool do_aa) {
+ // clipPaths can make our calls to IsFullQuad invalid (ie have false
// positives). As a precaution, force the setting to be non-solid
- // and non-transparent until we pop this
- if (forceNotSolidStackLevel_ == kNoLayer) {
- forceNotSolidStackLevel_ = savedStackSize_;
- (static_cast<AnalysisDevice*>(getDevice()))->setForceNotSolid(true);
+ // and non-transparent until we pop this
+ if (force_not_solid_stack_level_ == kNoLayer) {
+ force_not_solid_stack_level_ = saved_stack_size_;
+ (static_cast<AnalysisDevice*>(getDevice()))->SetForceNotSolid(true);
}
- if (forceNotTransparentStackLevel_ == kNoLayer) {
- forceNotTransparentStackLevel_ = savedStackSize_;
- (static_cast<AnalysisDevice*>(getDevice()))->setForceNotTransparent(true);
+ if (force_not_transparent_stack_level_ == kNoLayer) {
+ force_not_transparent_stack_level_ = saved_stack_size_;
+ (static_cast<AnalysisDevice*>(getDevice()))->SetForceNotTransparent(true);
}
- return INHERITED::clipRect(path.getBounds(), op, doAA);
+ return INHERITED::clipRect(path.getBounds(), op, do_aa);
}
-bool AnalysisCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op,
- bool doAA) {
- // clipRRect can make our calls to isFullQuad invalid (ie have false
+bool AnalysisCanvas::clipRRect(const SkRRect& rrect,
+ SkRegion::Op op,
+ bool do_aa) {
+ // clipRRect can make our calls to IsFullQuad invalid (ie have false
// positives). As a precaution, force the setting to be non-solid
- // and non-transparent until we pop this
- if (forceNotSolidStackLevel_ == kNoLayer) {
- forceNotSolidStackLevel_ = savedStackSize_;
- (static_cast<AnalysisDevice*>(getDevice()))->setForceNotSolid(true);
+ // and non-transparent until we pop this
+ if (force_not_solid_stack_level_ == kNoLayer) {
+ force_not_solid_stack_level_ = saved_stack_size_;
+ (static_cast<AnalysisDevice*>(getDevice()))->SetForceNotSolid(true);
}
- if (forceNotTransparentStackLevel_ == kNoLayer) {
- forceNotTransparentStackLevel_ = savedStackSize_;
- (static_cast<AnalysisDevice*>(getDevice()))->setForceNotTransparent(true);
+ if (force_not_transparent_stack_level_ == kNoLayer) {
+ force_not_transparent_stack_level_ = saved_stack_size_;
+ (static_cast<AnalysisDevice*>(getDevice()))->SetForceNotTransparent(true);
}
- return INHERITED::clipRect(rrect.getBounds(), op, doAA);
+ return INHERITED::clipRect(rrect.getBounds(), op, do_aa);
}
int AnalysisCanvas::save(SkCanvas::SaveFlags flags) {
- ++savedStackSize_;
+ ++saved_stack_size_;
return INHERITED::save(flags);
}
-int AnalysisCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
+int AnalysisCanvas::saveLayer(const SkRect* bounds,
+ const SkPaint* paint,
SkCanvas::SaveFlags flags) {
- ++savedStackSize_;
+ ++saved_stack_size_;
// If after we draw to the saved layer, we have to blend with the current
// layer, then we can conservatively say that the canvas will not be of
// solid color.
- if ((paint && !isSolidColorPaint(*paint)) ||
- (bounds && !bounds->contains(
- SkRect::MakeWH(getDevice()->width(), getDevice()->height())))) {
- if (forceNotSolidStackLevel_ == kNoLayer) {
- forceNotSolidStackLevel_ = savedStackSize_;
- (static_cast<AnalysisDevice*>(getDevice()))->setForceNotSolid(true);
+ if ((paint && !IsSolidColorPaint(*paint)) ||
+ (bounds && !bounds->contains(SkRect::MakeWH(getDevice()->width(),
+ getDevice()->height())))) {
+ if (force_not_solid_stack_level_ == kNoLayer) {
+ force_not_solid_stack_level_ = saved_stack_size_;
+ (static_cast<AnalysisDevice*>(getDevice()))->SetForceNotSolid(true);
}
}
// If after we draw to the save layer, we have to blend with the current
// layer using any part of the current layer's alpha, then we can
// conservatively say that the canvas will not be transparent.
- SkXfermode::Mode xferMode = SkXfermode::kSrc_Mode;
+ SkXfermode::Mode xfermode = SkXfermode::kSrc_Mode;
if (paint)
- SkXfermode::AsMode(paint->getXfermode(), &xferMode);
- if (xferMode != SkXfermode::kSrc_Mode) {
- if (forceNotTransparentStackLevel_ == kNoLayer) {
- forceNotTransparentStackLevel_ = savedStackSize_;
- (static_cast<AnalysisDevice*>(getDevice()))->setForceNotTransparent(true);
+ SkXfermode::AsMode(paint->getXfermode(), &xfermode);
+ if (xfermode != SkXfermode::kSrc_Mode) {
+ if (force_not_transparent_stack_level_ == kNoLayer) {
+ force_not_transparent_stack_level_ = saved_stack_size_;
+ (static_cast<AnalysisDevice*>(getDevice()))->SetForceNotTransparent(true);
}
}
@@ -379,16 +396,17 @@ int AnalysisCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
void AnalysisCanvas::restore() {
INHERITED::restore();
- DCHECK(savedStackSize_);
- if (savedStackSize_) {
- --savedStackSize_;
- if (savedStackSize_ < forceNotSolidStackLevel_) {
- (static_cast<AnalysisDevice*>(getDevice()))->setForceNotSolid(false);
- forceNotSolidStackLevel_ = kNoLayer;
+ DCHECK(saved_stack_size_);
+ if (saved_stack_size_) {
+ --saved_stack_size_;
+ if (saved_stack_size_ < force_not_solid_stack_level_) {
+ (static_cast<AnalysisDevice*>(getDevice()))->SetForceNotSolid(false);
+ force_not_solid_stack_level_ = kNoLayer;
}
- if (savedStackSize_ < forceNotTransparentStackLevel_) {
- (static_cast<AnalysisDevice*>(getDevice()))->setForceNotTransparent(false);
- forceNotTransparentStackLevel_ = kNoLayer;
+ if (saved_stack_size_ < force_not_transparent_stack_level_) {
+ (static_cast<AnalysisDevice*>(getDevice()))->SetForceNotTransparent(
+ false);
+ force_not_transparent_stack_level_ = kNoLayer;
}
}
}
diff --git a/skia/ext/analysis_canvas.h b/skia/ext/analysis_canvas.h
index 249c3c2..fa83975 100644
--- a/skia/ext/analysis_canvas.h
+++ b/skia/ext/analysis_canvas.h
@@ -25,8 +25,8 @@ class SK_API AnalysisCanvas : public SkCanvas, public SkDrawPictureCallback {
virtual ~AnalysisCanvas();
// Returns true when a SkColor can be used to represent result.
- bool getColorIfSolid(SkColor* color) const;
- bool hasText() const;
+ bool GetColorIfSolid(SkColor* color) const;
+ bool HasText() const;
// SkDrawPictureCallback override.
virtual bool abortDrawing() OVERRIDE;
@@ -34,98 +34,128 @@ class SK_API AnalysisCanvas : public SkCanvas, public SkDrawPictureCallback {
// SkCanvas overrides.
virtual bool clipRect(const SkRect& rect,
SkRegion::Op op = SkRegion::kIntersect_Op,
- bool doAntiAlias = false) OVERRIDE;
+ bool do_anti_alias = false) OVERRIDE;
virtual bool clipPath(const SkPath& path,
SkRegion::Op op = SkRegion::kIntersect_Op,
- bool doAntiAlias = false) OVERRIDE;
+ bool do_anti_alias = false) OVERRIDE;
virtual bool clipRRect(const SkRRect& rrect,
SkRegion::Op op = SkRegion::kIntersect_Op,
- bool doAntiAlias = false) OVERRIDE;
+ bool do_anti_alias = false) OVERRIDE;
- virtual int saveLayer(const SkRect* bounds, const SkPaint*,
- SkCanvas::SaveFlags flags) OVERRIDE;
+ virtual int saveLayer(const SkRect* bounds,
+ const SkPaint* paint,
+ SkCanvas::SaveFlags flags) OVERRIDE;
virtual int save(SaveFlags flags = kMatrixClip_SaveFlag) OVERRIDE;
virtual void restore() OVERRIDE;
private:
typedef SkCanvas INHERITED;
- static const int kNoLayer;
- int savedStackSize_;
- int forceNotSolidStackLevel_;
- int forceNotTransparentStackLevel_;
+ int saved_stack_size_;
+ int force_not_solid_stack_level_;
+ int force_not_transparent_stack_level_;
};
class SK_API AnalysisDevice : public SkDevice {
public:
- AnalysisDevice(const SkBitmap& bm);
+ AnalysisDevice(const SkBitmap& bitmap);
virtual ~AnalysisDevice();
- bool getColorIfSolid(SkColor* color) const;
- bool hasText() const;
+ bool GetColorIfSolid(SkColor* color) const;
+ bool HasText() const;
- void setForceNotSolid(bool flag);
- void setForceNotTransparent(bool flag);
+ void SetForceNotSolid(bool flag);
+ void SetForceNotTransparent(bool flag);
protected:
+ // SkDevice overrides.
virtual void clear(SkColor color) OVERRIDE;
- virtual void drawPaint(const SkDraw&, const SkPaint& paint) OVERRIDE;
- virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode,
- size_t count, const SkPoint[],
+ virtual void drawPaint(const SkDraw& draw, const SkPaint& paint) OVERRIDE;
+ virtual void drawPoints(const SkDraw& draw,
+ SkCanvas::PointMode mode,
+ size_t count,
+ const SkPoint points[],
const SkPaint& paint) OVERRIDE;
- virtual void drawRect(const SkDraw&, const SkRect& r,
+ virtual void drawRect(const SkDraw& draw,
+ const SkRect& rect,
const SkPaint& paint) OVERRIDE;
- virtual void drawOval(const SkDraw&, const SkRect& oval,
+ virtual void drawOval(const SkDraw& draw,
+ const SkRect& oval,
const SkPaint& paint) OVERRIDE;
- virtual void drawPath(const SkDraw&, const SkPath& path,
+ virtual void drawPath(const SkDraw& draw,
+ const SkPath& path,
const SkPaint& paint,
- const SkMatrix* prePathMatrix = NULL,
- bool pathIsMutable = false) OVERRIDE;
- virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap,
- const SkIRect* srcRectOrNull,
- const SkMatrix& matrix, const SkPaint& paint)
- OVERRIDE;
- virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap,
- int x, int y, const SkPaint& paint) OVERRIDE;
- virtual void drawBitmapRect(const SkDraw&, const SkBitmap&,
- const SkRect* srcOrNull, const SkRect& dst,
+ const SkMatrix* pre_path_matrix = NULL,
+ bool path_is_mutable = false) OVERRIDE;
+ virtual void drawBitmap(const SkDraw& draw,
+ const SkBitmap& bitmap,
+ const SkIRect* src_rect_or_null,
+ const SkMatrix& matrix,
+ const SkPaint& paint) OVERRIDE;
+ virtual void drawSprite(const SkDraw& draw,
+ const SkBitmap& bitmap,
+ int x,
+ int y,
+ const SkPaint& paint) OVERRIDE;
+ virtual void drawBitmapRect(const SkDraw& draw,
+ const SkBitmap& bitmap,
+ const SkRect* src_or_null,
+ const SkRect& dst,
const SkPaint& paint) OVERRIDE;
- virtual void drawText(const SkDraw&, const void* text, size_t len,
- SkScalar x, SkScalar y, const SkPaint& paint)
- OVERRIDE;
- virtual void drawPosText(const SkDraw& draw, const void* text, size_t len,
- const SkScalar pos[], SkScalar constY,
- int scalarsPerPos, const SkPaint& paint) OVERRIDE;
- virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len,
- const SkPath& path, const SkMatrix* matrix,
+ virtual void drawText(const SkDraw& draw,
+ const void* text,
+ size_t len,
+ SkScalar x,
+ SkScalar y,
+ const SkPaint& paint) OVERRIDE;
+ virtual void drawPosText(const SkDraw& draw,
+ const void* text,
+ size_t len,
+ const SkScalar pos[],
+ SkScalar const_y,
+ int scalars_per_pos,
+ const SkPaint& paint) OVERRIDE;
+ virtual void drawTextOnPath(const SkDraw& draw,
+ const void* text,
+ size_t len,
+ const SkPath& path,
+ const SkMatrix* matrix,
const SkPaint& paint) OVERRIDE;
#ifdef SK_BUILD_FOR_ANDROID
- virtual void drawPosTextOnPath(const SkDraw& draw, const void* text,
+ virtual void drawPosTextOnPath(const SkDraw& draw,
+ const void* text,
size_t len,
- const SkPoint pos[], const SkPaint& paint,
- const SkPath& path, const SkMatrix* matrix)
- OVERRIDE;
+ const SkPoint pos[],
+ const SkPaint& paint,
+ const SkPath& path,
+ const SkMatrix* matrix) OVERRIDE;
#endif
- virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode,
- int vertexCount,
- const SkPoint verts[], const SkPoint texs[],
- const SkColor colors[], SkXfermode* xmode,
- const uint16_t indices[], int indexCount,
+ virtual void drawVertices(const SkDraw& draw,
+ SkCanvas::VertexMode vertex_mode,
+ int vertex_count,
+ const SkPoint verts[],
+ const SkPoint texs[],
+ const SkColor colors[],
+ SkXfermode* xmode,
+ const uint16_t indices[],
+ int index_count,
const SkPaint& paint) OVERRIDE;
- virtual void drawDevice(const SkDraw&, SkDevice*, int x, int y,
- const SkPaint&) OVERRIDE;
+ virtual void drawDevice(const SkDraw& draw,
+ SkDevice* device,
+ int x,
+ int y,
+ const SkPaint& paint) OVERRIDE;
private:
-
typedef SkDevice INHERITED;
- bool isForcedNotSolid_;
- bool isForcedNotTransparent_;
- bool isSolidColor_;
+ bool is_forced_not_solid_;
+ bool is_forced_not_transparent_;
+ bool is_solid_color_;
SkColor color_;
- bool isTransparent_;
- bool hasText_;
+ bool is_transparent_;
+ bool has_text_;
};
} // namespace skia
diff --git a/skia/ext/analysis_canvas_unittest.cc b/skia/ext/analysis_canvas_unittest.cc
index 3efcafc..0b61031 100644
--- a/skia/ext/analysis_canvas_unittest.cc
+++ b/skia/ext/analysis_canvas_unittest.cc
@@ -9,11 +9,11 @@
namespace {
-void solidColorFill(skia::AnalysisCanvas& canvas) {
+void SolidColorFill(skia::AnalysisCanvas& canvas) {
canvas.clear(SkColorSetARGB(255, 255, 255, 255));
}
-void transparentFill(skia::AnalysisCanvas& canvas) {
+void TransparentFill(skia::AnalysisCanvas& canvas) {
canvas.clear(SkColorSetARGB(0, 0, 0, 0));
}
@@ -27,7 +27,7 @@ TEST(AnalysisCanvasTest, EmptyCanvas) {
skia::AnalysisCanvas canvas(&device);
SkColor color;
- EXPECT_TRUE(canvas.getColorIfSolid(&color));
+ EXPECT_TRUE(canvas.GetColorIfSolid(&color));
EXPECT_EQ(color, SkColorSetARGB(0, 0, 0, 0));
}
@@ -42,14 +42,14 @@ TEST(AnalysisCanvasTest, ClearCanvas) {
canvas.clear(color);
SkColor outputColor;
- EXPECT_TRUE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_TRUE(canvas.GetColorIfSolid(&outputColor));
EXPECT_EQ(static_cast<SkColor>(SK_ColorTRANSPARENT), outputColor);
// Solid color
color = SkColorSetARGB(255, 65, 43, 21);
canvas.clear(color);
- EXPECT_TRUE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_TRUE(canvas.GetColorIfSolid(&outputColor));
EXPECT_NE(static_cast<SkColor>(SK_ColorTRANSPARENT), outputColor);
EXPECT_EQ(outputColor, color);
@@ -57,15 +57,15 @@ TEST(AnalysisCanvasTest, ClearCanvas) {
color = SkColorSetARGB(128, 11, 22, 33);
canvas.clear(color);
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
// Test helper methods
- solidColorFill(canvas);
- EXPECT_TRUE(canvas.getColorIfSolid(&outputColor));
+ SolidColorFill(canvas);
+ EXPECT_TRUE(canvas.GetColorIfSolid(&outputColor));
EXPECT_NE(static_cast<SkColor>(SK_ColorTRANSPARENT), outputColor);
- transparentFill(canvas);
- EXPECT_TRUE(canvas.getColorIfSolid(&outputColor));
+ TransparentFill(canvas);
+ EXPECT_TRUE(canvas.GetColorIfSolid(&outputColor));
EXPECT_EQ(static_cast<SkColor>(SK_ColorTRANSPARENT), outputColor);
}
@@ -84,7 +84,7 @@ TEST(AnalysisCanvasTest, ComplexActions) {
SkColor outputColor;
//TODO(vmpstr): This should return true. (crbug.com/180597)
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
// Draw points test.
SkPoint points[4] = {
@@ -94,24 +94,24 @@ TEST(AnalysisCanvasTest, ComplexActions) {
SkPoint::Make(0, 255)
};
- solidColorFill(canvas);
+ SolidColorFill(canvas);
canvas.drawPoints(SkCanvas::kLines_PointMode, 4, points, paint);
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
// Draw oval test.
- solidColorFill(canvas);
+ SolidColorFill(canvas);
canvas.drawOval(SkRect::MakeWH(255, 255), paint);
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
// Draw bitmap test.
- solidColorFill(canvas);
+ SolidColorFill(canvas);
SkBitmap secondBitmap;
secondBitmap.setConfig(SkBitmap::kNo_Config, 255, 255);
canvas.drawBitmap(secondBitmap, 0, 0);
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
}
TEST(AnalysisCanvasTest, SimpleDrawRect) {
@@ -127,7 +127,7 @@ TEST(AnalysisCanvasTest, SimpleDrawRect) {
canvas.drawRect(SkRect::MakeWH(255, 255), paint);
SkColor outputColor;
- EXPECT_TRUE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_TRUE(canvas.GetColorIfSolid(&outputColor));
EXPECT_NE(static_cast<SkColor>(SK_ColorTRANSPARENT), outputColor);
EXPECT_EQ(color, outputColor);
@@ -136,13 +136,13 @@ TEST(AnalysisCanvasTest, SimpleDrawRect) {
canvas.translate(-128, -128);
canvas.drawRect(SkRect::MakeWH(382, 382), paint);
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
color = SkColorSetARGB(255, 33, 44, 55);
paint.setColor(color);
canvas.drawRect(SkRect::MakeWH(383, 383), paint);
- EXPECT_TRUE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_TRUE(canvas.GetColorIfSolid(&outputColor));
EXPECT_NE(static_cast<SkColor>(SK_ColorTRANSPARENT), outputColor);
EXPECT_EQ(color, outputColor);
@@ -150,7 +150,7 @@ TEST(AnalysisCanvasTest, SimpleDrawRect) {
paint.setColor(color);
canvas.drawRect(SkRect::MakeWH(383, 383), paint);
- EXPECT_TRUE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_TRUE(canvas.GetColorIfSolid(&outputColor));
EXPECT_NE(static_cast<SkColor>(SK_ColorTRANSPARENT), outputColor);
EXPECT_EQ(outputColor, SkColorSetARGB(255, 33, 44, 55));
@@ -158,16 +158,16 @@ TEST(AnalysisCanvasTest, SimpleDrawRect) {
paint.setColor(color);
canvas.drawRect(SkRect::MakeWH(383, 383), paint);
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
paint.setXfermodeMode(SkXfermode::kClear_Mode);
canvas.drawRect(SkRect::MakeWH(382, 382), paint);
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
canvas.drawRect(SkRect::MakeWH(383, 383), paint);
- EXPECT_TRUE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_TRUE(canvas.GetColorIfSolid(&outputColor));
EXPECT_EQ(static_cast<SkColor>(SK_ColorTRANSPARENT), outputColor);
canvas.translate(128, 128);
@@ -176,14 +176,14 @@ TEST(AnalysisCanvasTest, SimpleDrawRect) {
paint.setXfermodeMode(SkXfermode::kSrcOver_Mode);
canvas.drawRect(SkRect::MakeWH(255, 255), paint);
- EXPECT_TRUE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_TRUE(canvas.GetColorIfSolid(&outputColor));
EXPECT_NE(static_cast<SkColor>(SK_ColorTRANSPARENT), outputColor);
EXPECT_EQ(color, outputColor);
canvas.rotate(50);
canvas.drawRect(SkRect::MakeWH(255, 255), paint);
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
}
TEST(AnalysisCanvasTest, ClipPath) {
@@ -199,21 +199,21 @@ TEST(AnalysisCanvasTest, ClipPath) {
path.lineTo(0, 255);
SkColor outputColor;
- solidColorFill(canvas);
+ SolidColorFill(canvas);
canvas.clipPath(path);
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
canvas.save();
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
canvas.clipPath(path);
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
canvas.restore();
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
- solidColorFill(canvas);
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ SolidColorFill(canvas);
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
}
TEST(AnalysisCanvasTest, SaveLayerRestore) {
@@ -223,8 +223,8 @@ TEST(AnalysisCanvasTest, SaveLayerRestore) {
skia::AnalysisCanvas canvas(&device);
SkColor outputColor;
- solidColorFill(canvas);
- EXPECT_TRUE(canvas.getColorIfSolid(&outputColor));
+ SolidColorFill(canvas);
+ EXPECT_TRUE(canvas.GetColorIfSolid(&outputColor));
SkRect bounds = SkRect::MakeWH(255, 255);
SkPaint paint;
@@ -233,48 +233,48 @@ TEST(AnalysisCanvasTest, SaveLayerRestore) {
// This should force non-transparency
canvas.saveLayer(&bounds, &paint, SkCanvas::kMatrix_SaveFlag);
- EXPECT_TRUE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_TRUE(canvas.GetColorIfSolid(&outputColor));
EXPECT_NE(static_cast<SkColor>(SK_ColorTRANSPARENT), outputColor);
- transparentFill(canvas);
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ TransparentFill(canvas);
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
- solidColorFill(canvas);
- EXPECT_TRUE(canvas.getColorIfSolid(&outputColor));
+ SolidColorFill(canvas);
+ EXPECT_TRUE(canvas.GetColorIfSolid(&outputColor));
EXPECT_NE(static_cast<SkColor>(SK_ColorTRANSPARENT), outputColor);
paint.setXfermodeMode(SkXfermode::kDst_Mode);
// This should force non-solid color
canvas.saveLayer(&bounds, &paint, SkCanvas::kMatrix_SaveFlag);
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
- transparentFill(canvas);
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ TransparentFill(canvas);
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
- solidColorFill(canvas);
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ SolidColorFill(canvas);
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
canvas.restore();
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
- transparentFill(canvas);
- EXPECT_FALSE(canvas.getColorIfSolid(&outputColor));
+ TransparentFill(canvas);
+ EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
- solidColorFill(canvas);
- EXPECT_TRUE(canvas.getColorIfSolid(&outputColor));
+ SolidColorFill(canvas);
+ EXPECT_TRUE(canvas.GetColorIfSolid(&outputColor));
EXPECT_NE(static_cast<SkColor>(SK_ColorTRANSPARENT), outputColor);
canvas.restore();
- EXPECT_TRUE(canvas.getColorIfSolid(&outputColor));
+ EXPECT_TRUE(canvas.GetColorIfSolid(&outputColor));
EXPECT_NE(static_cast<SkColor>(SK_ColorTRANSPARENT), outputColor);
- transparentFill(canvas);
- EXPECT_TRUE(canvas.getColorIfSolid(&outputColor));
+ TransparentFill(canvas);
+ EXPECT_TRUE(canvas.GetColorIfSolid(&outputColor));
EXPECT_EQ(static_cast<SkColor>(SK_ColorTRANSPARENT), outputColor);
- solidColorFill(canvas);
- EXPECT_TRUE(canvas.getColorIfSolid(&outputColor));
+ SolidColorFill(canvas);
+ EXPECT_TRUE(canvas.GetColorIfSolid(&outputColor));
EXPECT_NE(static_cast<SkColor>(SK_ColorTRANSPARENT), outputColor);
}
@@ -301,85 +301,85 @@ TEST(AnalysisCanvasTest, HasText) {
skia::AnalysisDevice device(bitmap);
skia::AnalysisCanvas canvas(&device);
// Test after initialization.
- EXPECT_FALSE(canvas.hasText());
+ EXPECT_FALSE(canvas.HasText());
// Test drawing anything other than text.
canvas.drawRect(SkRect::MakeWH(width/2, height), paint);
- EXPECT_FALSE(canvas.hasText());
+ EXPECT_FALSE(canvas.HasText());
}
{
// Test SkCanvas::drawText.
skia::AnalysisDevice device(bitmap);
skia::AnalysisCanvas canvas(&device);
canvas.drawText(text, byteLength, point.fX, point.fY, paint);
- EXPECT_TRUE(canvas.hasText());
+ EXPECT_TRUE(canvas.HasText());
}
{
// Test SkCanvas::drawPosText.
skia::AnalysisDevice device(bitmap);
skia::AnalysisCanvas canvas(&device);
canvas.drawPosText(text, byteLength, &point, paint);
- EXPECT_TRUE(canvas.hasText());
+ EXPECT_TRUE(canvas.HasText());
}
{
// Test SkCanvas::drawPosTextH.
skia::AnalysisDevice device(bitmap);
skia::AnalysisCanvas canvas(&device);
canvas.drawPosTextH(text, byteLength, &point.fX, point.fY, paint);
- EXPECT_TRUE(canvas.hasText());
+ EXPECT_TRUE(canvas.HasText());
}
{
// Test SkCanvas::drawTextOnPathHV.
skia::AnalysisDevice device(bitmap);
skia::AnalysisCanvas canvas(&device);
canvas.drawTextOnPathHV(text, byteLength, path, point.fX, point.fY, paint);
- EXPECT_TRUE(canvas.hasText());
+ EXPECT_TRUE(canvas.HasText());
}
{
// Test SkCanvas::drawTextOnPath.
skia::AnalysisDevice device(bitmap);
skia::AnalysisCanvas canvas(&device);
canvas.drawTextOnPath(text, byteLength, path, NULL, paint);
- EXPECT_TRUE(canvas.hasText());
+ EXPECT_TRUE(canvas.HasText());
}
{
// Text under opaque rect.
skia::AnalysisDevice device(bitmap);
skia::AnalysisCanvas canvas(&device);
canvas.drawText(text, byteLength, point.fX, point.fY, paint);
- EXPECT_TRUE(canvas.hasText());
+ EXPECT_TRUE(canvas.HasText());
canvas.drawRect(SkRect::MakeWH(width, height), paint);
- EXPECT_FALSE(canvas.hasText());
+ EXPECT_FALSE(canvas.HasText());
}
{
// Text under translucent rect.
skia::AnalysisDevice device(bitmap);
skia::AnalysisCanvas canvas(&device);
canvas.drawText(text, byteLength, point.fX, point.fY, paint);
- EXPECT_TRUE(canvas.hasText());
+ EXPECT_TRUE(canvas.HasText());
SkPaint translucentPaint;
translucentPaint.setColor(0x88FFFFFF);
canvas.drawRect(SkRect::MakeWH(width, height), translucentPaint);
- EXPECT_TRUE(canvas.hasText());
+ EXPECT_TRUE(canvas.HasText());
}
{
// Text under rect in clear mode.
skia::AnalysisDevice device(bitmap);
skia::AnalysisCanvas canvas(&device);
canvas.drawText(text, byteLength, point.fX, point.fY, paint);
- EXPECT_TRUE(canvas.hasText());
+ EXPECT_TRUE(canvas.HasText());
SkPaint clearModePaint;
clearModePaint.setXfermodeMode(SkXfermode::kClear_Mode);
canvas.drawRect(SkRect::MakeWH(width, height), clearModePaint);
- EXPECT_FALSE(canvas.hasText());
+ EXPECT_FALSE(canvas.HasText());
}
{
// Clear.
skia::AnalysisDevice device(bitmap);
skia::AnalysisCanvas canvas(&device);
canvas.drawText(text, byteLength, point.fX, point.fY, paint);
- EXPECT_TRUE(canvas.hasText());
+ EXPECT_TRUE(canvas.HasText());
canvas.clear(SK_ColorGRAY);
- EXPECT_FALSE(canvas.hasText());
+ EXPECT_FALSE(canvas.HasText());
}
{
// Text inside clip region.
@@ -387,7 +387,7 @@ TEST(AnalysisCanvasTest, HasText) {
skia::AnalysisCanvas canvas(&device);
canvas.clipRect(SkRect::MakeWH(100, 100));
canvas.drawText(text, byteLength, point.fX, point.fY, paint);
- EXPECT_TRUE(canvas.hasText());
+ EXPECT_TRUE(canvas.HasText());
}
{
// Text outside clip region.
@@ -399,7 +399,7 @@ TEST(AnalysisCanvasTest, HasText) {
// So even when text is outside the clip region,
// it is marked as having the text.
// TODO(alokp): We may be able to do some trivial rejection.
- EXPECT_TRUE(canvas.hasText());
+ EXPECT_TRUE(canvas.HasText());
}
}