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

Unified Diff: src/core/SkPictureRecord.cpp

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
« src/core/SkPictureRecord.h ('K') | « src/core/SkPictureRecord.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPictureRecord.cpp
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 7a853816ae72b702b0915c5829587a593bf933a0..c05123edfd39a9f5bf22b9c7ff0a075113610293 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -1106,6 +1106,12 @@ void SkPictureRecord::drawPosText(const void* text, size_t byteLength,
void SkPictureRecord::drawPosTextH(const void* text, size_t byteLength,
const SkScalar xpos[], SkScalar constY,
const SkPaint& paint) {
+ drawPosTextHImpl(text, byteLength, xpos, constY, paint, NULL);
reed1 2013/08/20 17:59:23 Might be clearer if we called getFlatPaintData her
+
+}
+void SkPictureRecord::drawPosTextHImpl(const void* text, size_t byteLength,
+ const SkScalar xpos[], SkScalar constY,
+ const SkPaint& paint, const SkFlatData* flatPaintData) {
size_t points = paint.countText(text, byteLength);
if (0 == points)
return;
@@ -1119,11 +1125,15 @@ void SkPictureRecord::drawPosTextH(const void* text, size_t byteLength,
}
// + y + the actual points
size += 1 * kUInt32Size + points * sizeof(SkScalar);
-
uint32_t initialOffset = this->addDraw(fast ? DRAW_POS_TEXT_H_TOP_BOTTOM : DRAW_POS_TEXT_H,
&size);
- const SkFlatData* flatPaintData = addPaint(paint);
+ if (NULL == flatPaintData) {
+ flatPaintData = addPaint(paint);
+ } else {
+ addFlatPaint(flatPaintData);
+ }
SkASSERT(flatPaintData);
+
addText(text, byteLength);
addInt(points);
@@ -1268,13 +1278,21 @@ void SkPictureRecord::addMatrixPtr(const SkMatrix* matrix) {
this->addInt(matrix ? fMatrices.find(*matrix) : 0);
}
+const SkFlatData* SkPictureRecord::getFlatPaintData(const SkPaint& paint) {
+ return fPaints.findAndReturnFlat(paint);
+}
+
const SkFlatData* SkPictureRecord::addPaintPtr(const SkPaint* paint) {
- const SkFlatData* data = paint ? fPaints.findAndReturnFlat(*paint) : NULL;
- int index = data ? data->index() : 0;
- this->addInt(index);
+ const SkFlatData* data = paint ? getFlatPaintData(*paint) : NULL;
+ this->addFlatPaint(data);
return data;
}
+void SkPictureRecord::addFlatPaint(const SkFlatData* flatPaint) {
+ int index = flatPaint ? flatPaint->index() : 0;
+ this->addInt(index);
+}
+
void SkPictureRecord::addPath(const SkPath& path) {
if (NULL == fPathHeap) {
fPathHeap = SkNEW(SkPathHeap);
« src/core/SkPictureRecord.h ('K') | « src/core/SkPictureRecord.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698