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

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

Issue 2197243003: Replace old SkRecords RefBox with sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: builds Created 4 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 unified diff | Download patch
« no previous file with comments | « src/core/SkMiniRecorder.cpp ('k') | src/core/SkRecorder.cpp » ('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 "SkRecordDraw.h" 8 #include "SkRecordDraw.h"
9 #include "SkPatchUtils.h" 9 #include "SkPatchUtils.h"
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 namespace SkRecords { 72 namespace SkRecords {
73 73
74 // NoOps draw nothing. 74 // NoOps draw nothing.
75 template <> void Draw::draw(const NoOp&) {} 75 template <> void Draw::draw(const NoOp&) {}
76 76
77 #define DRAW(T, call) template <> void Draw::draw(const T& r) { fCanvas->call; } 77 #define DRAW(T, call) template <> void Draw::draw(const T& r) { fCanvas->call; }
78 DRAW(Restore, restore()); 78 DRAW(Restore, restore());
79 DRAW(Save, save()); 79 DRAW(Save, save());
80 DRAW(SaveLayer, saveLayer(SkCanvas::SaveLayerRec(r.bounds, r.paint, r.backdrop, r.saveLayerFlags))); 80 DRAW(SaveLayer, saveLayer(SkCanvas::SaveLayerRec(r.bounds,
81 r.paint,
82 r.backdrop.get(),
83 r.saveLayerFlags)));
81 DRAW(SetMatrix, setMatrix(SkMatrix::Concat(fInitialCTM, r.matrix))); 84 DRAW(SetMatrix, setMatrix(SkMatrix::Concat(fInitialCTM, r.matrix)));
82 DRAW(Concat, concat(r.matrix)); 85 DRAW(Concat, concat(r.matrix));
83 86
84 DRAW(ClipPath, clipPath(r.path, r.opAA.op, r.opAA.aa)); 87 DRAW(ClipPath, clipPath(r.path, r.opAA.op, r.opAA.aa));
85 DRAW(ClipRRect, clipRRect(r.rrect, r.opAA.op, r.opAA.aa)); 88 DRAW(ClipRRect, clipRRect(r.rrect, r.opAA.op, r.opAA.aa));
86 DRAW(ClipRect, clipRect(r.rect, r.opAA.op, r.opAA.aa)); 89 DRAW(ClipRect, clipRect(r.rect, r.opAA.op, r.opAA.aa));
87 DRAW(ClipRegion, clipRegion(r.region, r.op)); 90 DRAW(ClipRegion, clipRegion(r.region, r.op));
88 91
89 #ifdef SK_EXPERIMENTAL_SHADOWING 92 #ifdef SK_EXPERIMENTAL_SHADOWING
90 DRAW(TranslateZ, SkCanvas::translateZ(r.z)); 93 DRAW(TranslateZ, SkCanvas::translateZ(r.z));
91 #else 94 #else
92 template <> void Draw::draw(const TranslateZ& r) { } 95 template <> void Draw::draw(const TranslateZ& r) { }
93 #endif 96 #endif
94 97
95 DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint)); 98 DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint));
96 DRAW(DrawImage, drawImage(r.image, r.left, r.top, r.paint)); 99 DRAW(DrawImage, drawImage(r.image.get(), r.left, r.top, r.paint));
97 DRAW(DrawImageRect, legacy_drawImageRect(r.image, r.src, r.dst, r.paint, r.const raint)); 100 DRAW(DrawImageRect, legacy_drawImageRect(r.image.get(), r.src, r.dst, r.paint, r .constraint));
98 DRAW(DrawImageNine, drawImageNine(r.image, r.center, r.dst, r.paint)); 101 DRAW(DrawImageNine, drawImageNine(r.image.get(), r.center, r.dst, r.paint));
99 DRAW(DrawOval, drawOval(r.oval, r.paint)); 102 DRAW(DrawOval, drawOval(r.oval, r.paint));
100 DRAW(DrawPaint, drawPaint(r.paint)); 103 DRAW(DrawPaint, drawPaint(r.paint));
101 DRAW(DrawPath, drawPath(r.path, r.paint)); 104 DRAW(DrawPath, drawPath(r.path, r.paint));
102 DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.xmode, r.paint)); 105 DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.xmode, r.paint));
103 DRAW(DrawPicture, drawPicture(r.picture, &r.matrix, r.paint)); 106 DRAW(DrawPicture, drawPicture(r.picture.get(), &r.matrix, r.paint));
104 107
105 #ifdef SK_EXPERIMENTAL_SHADOWING 108 #ifdef SK_EXPERIMENTAL_SHADOWING
106 DRAW(DrawShadowedPicture, drawShadowedPicture(r.picture, &r.matrix, r.paint)); 109 DRAW(DrawShadowedPicture, drawShadowedPicture(r.picture.get(), &r.matrix, r.pain t));
107 #else 110 #else
108 template <> void Draw::draw(const DrawShadowedPicture& r) { } 111 template <> void Draw::draw(const DrawShadowedPicture& r) { }
109 #endif 112 #endif
110 113
111 DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint)); 114 DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint));
112 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); 115 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint));
113 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); 116 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint));
114 DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); 117 DRAW(DrawRRect, drawRRect(r.rrect, r.paint));
115 DRAW(DrawRect, drawRect(r.rect, r.paint)); 118 DRAW(DrawRect, drawRect(r.rect, r.paint));
116 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); 119 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint));
117 DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint)); 120 DRAW(DrawTextBlob, drawTextBlob(r.blob.get(), r.x, r.y, r.paint));
118 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p aint)); 121 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p aint));
119 DRAW(DrawTextRSXform, drawTextRSXform(r.text, r.byteLength, r.xforms, r.cull, r. paint)); 122 DRAW(DrawTextRSXform, drawTextRSXform(r.text, r.byteLength, r.xforms, r.cull, r. paint));
120 DRAW(DrawAtlas, drawAtlas(r.atlas, r.xforms, r.texs, r.colors, r.count, r.mode, r.cull, r.paint)); 123 DRAW(DrawAtlas, drawAtlas(r.atlas.get(),
124 r.xforms, r.texs, r.colors, r.count, r.mode, r.cull, r .paint));
121 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co lors, 125 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co lors,
122 r.xmode, r.indices, r.indexCount, r.paint)); 126 r.xmode, r.indices, r.indexCount, r.paint));
123 DRAW(DrawAnnotation, drawAnnotation(r.rect, r.key.c_str(), r.value)); 127 DRAW(DrawAnnotation, drawAnnotation(r.rect, r.key.c_str(), r.value.get()));
124 #undef DRAW 128 #undef DRAW
125 129
126 template <> void Draw::draw(const DrawDrawable& r) { 130 template <> void Draw::draw(const DrawDrawable& r) {
127 SkASSERT(r.index >= 0); 131 SkASSERT(r.index >= 0);
128 SkASSERT(r.index < fDrawableCount); 132 SkASSERT(r.index < fDrawableCount);
129 if (fDrawables) { 133 if (fDrawables) {
130 SkASSERT(nullptr == fDrawablePicts); 134 SkASSERT(nullptr == fDrawablePicts);
131 fCanvas->drawDrawable(fDrawables[r.index], r.matrix); 135 fCanvas->drawDrawable(fDrawables[r.index], r.matrix);
132 } else { 136 } else {
133 fCanvas->drawPicture(fDrawablePicts[r.index], r.matrix, nullptr); 137 fCanvas->drawPicture(fDrawablePicts[r.index], r.matrix, nullptr);
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 400
397 Bounds bounds(const DrawRect& op) const { return this->adjustAndMap(op.rect, &op.paint); } 401 Bounds bounds(const DrawRect& op) const { return this->adjustAndMap(op.rect, &op.paint); }
398 Bounds bounds(const DrawOval& op) const { return this->adjustAndMap(op.oval, &op.paint); } 402 Bounds bounds(const DrawOval& op) const { return this->adjustAndMap(op.oval, &op.paint); }
399 Bounds bounds(const DrawRRect& op) const { 403 Bounds bounds(const DrawRRect& op) const {
400 return this->adjustAndMap(op.rrect.rect(), &op.paint); 404 return this->adjustAndMap(op.rrect.rect(), &op.paint);
401 } 405 }
402 Bounds bounds(const DrawDRRect& op) const { 406 Bounds bounds(const DrawDRRect& op) const {
403 return this->adjustAndMap(op.outer.rect(), &op.paint); 407 return this->adjustAndMap(op.outer.rect(), &op.paint);
404 } 408 }
405 Bounds bounds(const DrawImage& op) const { 409 Bounds bounds(const DrawImage& op) const {
406 const SkImage* image = op.image; 410 const SkImage* image = op.image.get();
407 SkRect rect = SkRect::MakeXYWH(op.left, op.top, image->width(), image->h eight()); 411 SkRect rect = SkRect::MakeXYWH(op.left, op.top, image->width(), image->h eight());
408 412
409 return this->adjustAndMap(rect, op.paint); 413 return this->adjustAndMap(rect, op.paint);
410 } 414 }
411 Bounds bounds(const DrawImageRect& op) const { 415 Bounds bounds(const DrawImageRect& op) const {
412 return this->adjustAndMap(op.dst, op.paint); 416 return this->adjustAndMap(op.dst, op.paint);
413 } 417 }
414 Bounds bounds(const DrawImageNine& op) const { 418 Bounds bounds(const DrawImageNine& op) const {
415 return this->adjustAndMap(op.dst, op.paint); 419 return this->adjustAndMap(op.dst, op.paint);
416 } 420 }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 605
602 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkRect b ounds[]) { 606 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkRect b ounds[]) {
603 SkRecords::FillBounds visitor(cullRect, record, bounds); 607 SkRecords::FillBounds visitor(cullRect, record, bounds);
604 for (int curOp = 0; curOp < record.count(); curOp++) { 608 for (int curOp = 0; curOp < record.count(); curOp++) {
605 visitor.setCurrentOp(curOp); 609 visitor.setCurrentOp(curOp);
606 record.visit(curOp, visitor); 610 record.visit(curOp, visitor);
607 } 611 }
608 visitor.cleanUp(); 612 visitor.cleanUp();
609 } 613 }
610 614
OLDNEW
« no previous file with comments | « src/core/SkMiniRecorder.cpp ('k') | src/core/SkRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698