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

Side by Side Diff: src/core/SkRecordDraw.cpp

Issue 1758023003: Move annotations to canvas virtual (patchset #8 id:140001 of https://codereview.chromium.org/174410… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: manual rebase Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « src/core/SkReader32.h ('k') | src/core/SkRecorder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkLayerInfo.h" 8 #include "SkLayerInfo.h"
9 #include "SkRecordDraw.h" 9 #include "SkRecordDraw.h"
10 #include "SkPatchUtils.h" 10 #include "SkPatchUtils.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); 110 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint));
111 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); 111 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint));
112 DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); 112 DRAW(DrawRRect, drawRRect(r.rrect, r.paint));
113 DRAW(DrawRect, drawRect(r.rect, r.paint)); 113 DRAW(DrawRect, drawRect(r.rect, r.paint));
114 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); 114 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint));
115 DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint)); 115 DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint));
116 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p aint)); 116 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p aint));
117 DRAW(DrawAtlas, drawAtlas(r.atlas, r.xforms, r.texs, r.colors, r.count, r.mode, r.cull, r.paint)); 117 DRAW(DrawAtlas, drawAtlas(r.atlas, r.xforms, r.texs, r.colors, r.count, r.mode, r.cull, r.paint));
118 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co lors, 118 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co lors,
119 r.xmode, r.indices, r.indexCount, r.paint)); 119 r.xmode, r.indices, r.indexCount, r.paint));
120 DRAW(DrawAnnotation, drawAnnotation(r.rect, r.key.c_str(), r.value));
120 #undef DRAW 121 #undef DRAW
121 122
122 template <> void Draw::draw(const DrawDrawable& r) { 123 template <> void Draw::draw(const DrawDrawable& r) {
123 SkASSERT(r.index >= 0); 124 SkASSERT(r.index >= 0);
124 SkASSERT(r.index < fDrawableCount); 125 SkASSERT(r.index < fDrawableCount);
125 if (fDrawables) { 126 if (fDrawables) {
126 SkASSERT(nullptr == fDrawablePicts); 127 SkASSERT(nullptr == fDrawablePicts);
127 fCanvas->drawDrawable(fDrawables[r.index], r.matrix); 128 fCanvas->drawDrawable(fDrawables[r.index], r.matrix);
128 } else { 129 } else {
129 fCanvas->drawPicture(fDrawablePicts[r.index], r.matrix, nullptr); 130 fCanvas->drawPicture(fDrawablePicts[r.index], r.matrix, nullptr);
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 Bounds bounds(const DrawTextBlob& op) const { 511 Bounds bounds(const DrawTextBlob& op) const {
511 SkRect dst = op.blob->bounds(); 512 SkRect dst = op.blob->bounds();
512 dst.offset(op.x, op.y); 513 dst.offset(op.x, op.y);
513 return this->adjustAndMap(dst, &op.paint); 514 return this->adjustAndMap(dst, &op.paint);
514 } 515 }
515 516
516 Bounds bounds(const DrawDrawable& op) const { 517 Bounds bounds(const DrawDrawable& op) const {
517 return this->adjustAndMap(op.worstCaseBounds, nullptr); 518 return this->adjustAndMap(op.worstCaseBounds, nullptr);
518 } 519 }
519 520
521 Bounds bounds(const DrawAnnotation& op) const {
522 return this->adjustAndMap(op.rect, nullptr);
523 }
524
520 static void AdjustTextForFontMetrics(SkRect* rect, const SkPaint& paint) { 525 static void AdjustTextForFontMetrics(SkRect* rect, const SkPaint& paint) {
521 #ifdef SK_DEBUG 526 #ifdef SK_DEBUG
522 SkRect correct = *rect; 527 SkRect correct = *rect;
523 #endif 528 #endif
524 // crbug.com/373785 ~~> xPad = 4x yPad 529 // crbug.com/373785 ~~> xPad = 4x yPad
525 // crbug.com/424824 ~~> bump yPad from 2x text size to 2.5x 530 // crbug.com/424824 ~~> bump yPad from 2x text size to 2.5x
526 const SkScalar yPad = 2.5f * paint.getTextSize(), 531 const SkScalar yPad = 2.5f * paint.getTextSize(),
527 xPad = 4.0f * yPad; 532 xPad = 4.0f * yPad;
528 rect->outset(xPad, yPad); 533 rect->outset(xPad, yPad);
529 #ifdef SK_DEBUG 534 #ifdef SK_DEBUG
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 void SkRecordComputeLayers(const SkRect& cullRect, const SkRecord& record, SkRec t bounds[], 805 void SkRecordComputeLayers(const SkRect& cullRect, const SkRecord& record, SkRec t bounds[],
801 const SkBigPicture::SnapshotArray* pictList, SkLayerI nfo* data) { 806 const SkBigPicture::SnapshotArray* pictList, SkLayerI nfo* data) {
802 SkRecords::CollectLayers visitor(cullRect, record, bounds, pictList, data); 807 SkRecords::CollectLayers visitor(cullRect, record, bounds, pictList, data);
803 for (int curOp = 0; curOp < record.count(); curOp++) { 808 for (int curOp = 0; curOp < record.count(); curOp++) {
804 visitor.setCurrentOp(curOp); 809 visitor.setCurrentOp(curOp);
805 record.visit<void>(curOp, visitor); 810 record.visit<void>(curOp, visitor);
806 } 811 }
807 visitor.cleanUp(); 812 visitor.cleanUp();
808 } 813 }
809 814
OLDNEW
« no previous file with comments | « src/core/SkReader32.h ('k') | src/core/SkRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698