Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Unified Diff: src/core/SkPictureRecord.h

Issue 23001007: Remove the call to getFontMetrics from SkBBoxRecord (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkBBoxRecord.cpp ('k') | src/core/SkPictureRecord.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPictureRecord.h
diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h
index 51547a4741cf3d4287e944033e7afa0178548d03..b900f4f5747f8e68358d1c3491ebf75f9a31c224 100644
--- a/src/core/SkPictureRecord.h
+++ b/src/core/SkPictureRecord.h
@@ -165,6 +165,7 @@ private:
void addMatrixPtr(const SkMatrix* matrix);
const SkFlatData* addPaint(const SkPaint& paint) { return this->addPaintPtr(&paint); }
const SkFlatData* addPaintPtr(const SkPaint* paint);
+ void addFlatPaint(const SkFlatData* flatPaint);
void addPath(const SkPath& path);
void addPicture(SkPicture& picture);
void addPoint(const SkPoint& point);
@@ -216,6 +217,26 @@ public:
#endif
protected:
+ // Return fontmetrics.fTop,fBottom in topbot[0,1], after they have been
+ // tweaked by paint.computeFastBounds().
+ static void ComputeFontMetricsTopBottom(const SkPaint& paint, SkScalar topbot[2]);
+
+ // Make sure that flat has fTopBot written.
+ static void WriteTopBot(const SkPaint& paint, const SkFlatData& flat) {
+ if (!flat.isTopBotWritten()) {
+ ComputeFontMetricsTopBottom(paint, flat.writableTopBot());
+ SkASSERT(flat.isTopBotWritten());
+ }
+ }
+ // Will return a cached version when possible.
+ const SkFlatData* getFlatPaintData(const SkPaint& paint);
+ /**
+ * SkBBoxRecord::drawPosTextH gets a flat paint and uses it,
+ * then it calls this, using the extra parameter, to avoid duplication.
+ */
+ void drawPosTextHImpl(const void* text, size_t byteLength,
+ const SkScalar xpos[], SkScalar constY,
+ const SkPaint& paint, const SkFlatData* flatPaintData);
// These are set to NULL in our constructor, but may be changed by
// subclasses, in which case they will be SkSafeUnref'd in our destructor.
« no previous file with comments | « src/core/SkBBoxRecord.cpp ('k') | src/core/SkPictureRecord.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698