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

Side by Side Diff: src/record/SkRecordDraw.h

Issue 224723026: Add push/pop cull to SkRecord. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 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 | « no previous file | src/record/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 #ifndef SkRecordDraw_DEFINED 1 #ifndef SkRecordDraw_DEFINED
2 #define SkRecordDraw_DEFINED 2 #define SkRecordDraw_DEFINED
3 3
4 #include "SkRecord.h" 4 #include "SkRecord.h"
5 #include "SkRecords.h" 5 #include "SkRecords.h"
6 #include "SkCanvas.h" 6 #include "SkCanvas.h"
7 7
8 // This is an SkRecord visitor that will draw that SkRecord to an SkCanvas. 8 // This is an SkRecord visitor that will draw that SkRecord to an SkCanvas.
9 9
10 struct SkRecordDraw { 10 struct SkRecordDraw {
11 explicit SkRecordDraw(SkCanvas* canvas) : canvas(canvas) {} 11 explicit SkRecordDraw(SkCanvas* canvas) : canvas(canvas) {}
12 12
13 // No base case, so we'll be compile-time checked that we implemented all po ssibilities below. 13 // No base case, so we'll be compile-time checked that we implemented all po ssibilities below.
14 template <typename T> void operator()(const T& record); 14 template <typename T> void operator()(const T& record);
15 15
16 SkCanvas* canvas; 16 SkCanvas* canvas;
17 }; 17 };
18 18
19 // Nothing fancy here. 19 // Nothing fancy here.
20 // The structs in SkRecord are completely isomorphic to their corresponding SkCa nvas calls. 20 // The structs in SkRecord are completely isomorphic to their corresponding SkCa nvas calls.
21 21
22 #define CASE(T) template <> void SkRecordDraw::operator()(const SkRecords::T& r) 22 #define CASE(T) template <> void SkRecordDraw::operator()(const SkRecords::T& r)
23 23
24 CASE(Restore) { canvas->restore(); } 24 CASE(Restore) { canvas->restore(); }
25 CASE(Save) { canvas->save(r.flags); } 25 CASE(Save) { canvas->save(r.flags); }
26 CASE(SaveLayer) { canvas->saveLayer(r.bounds, r.paint, r.flags); } 26 CASE(SaveLayer) { canvas->saveLayer(r.bounds, r.paint, r.flags); }
27 27
28 CASE(PushCull) { canvas->pushCull(r.rect); }
29 CASE(PopCull) { canvas->popCull(); }
30
28 CASE(Concat) { canvas->concat(r.matrix); } 31 CASE(Concat) { canvas->concat(r.matrix); }
29 CASE(SetMatrix) { canvas->setMatrix(r.matrix); } 32 CASE(SetMatrix) { canvas->setMatrix(r.matrix); }
30 33
31 CASE(ClipPath) { canvas->clipPath(r.path, r.op, r.doAA); } 34 CASE(ClipPath) { canvas->clipPath(r.path, r.op, r.doAA); }
32 CASE(ClipRRect) { canvas->clipRRect(r.rrect, r.op, r.doAA); } 35 CASE(ClipRRect) { canvas->clipRRect(r.rrect, r.op, r.doAA); }
33 CASE(ClipRect) { canvas->clipRect(r.rect, r.op, r.doAA); } 36 CASE(ClipRect) { canvas->clipRect(r.rect, r.op, r.doAA); }
34 CASE(ClipRegion) { canvas->clipRegion(r.region, r.op); } 37 CASE(ClipRegion) { canvas->clipRegion(r.region, r.op); }
35 38
36 CASE(Clear) { canvas->clear(r.color); } 39 CASE(Clear) { canvas->clear(r.color); }
37 CASE(DrawBitmap) { canvas->drawBitmap(r.bitmap, r.left, r.top, r.paint); } 40 CASE(DrawBitmap) { canvas->drawBitmap(r.bitmap, r.left, r.top, r.paint); }
(...skipping 15 matching lines...) Expand all
53 CASE(DrawText) { canvas->drawText(r.text, r.byteLength, r.x, r.y, r.paint); } 56 CASE(DrawText) { canvas->drawText(r.text, r.byteLength, r.x, r.y, r.paint); }
54 CASE(DrawTextOnPath) { canvas->drawTextOnPath(r.text, r.byteLength, r.path, r.ma trix, r.paint); } 57 CASE(DrawTextOnPath) { canvas->drawTextOnPath(r.text, r.byteLength, r.path, r.ma trix, r.paint); }
55 CASE(DrawVertices) { 58 CASE(DrawVertices) {
56 canvas->drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.colors, 59 canvas->drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.colors,
57 r.xmode.get(), r.indices, r.indexCount, r.paint); 60 r.xmode.get(), r.indices, r.indexCount, r.paint);
58 } 61 }
59 62
60 #undef CASE 63 #undef CASE
61 64
62 #endif//SkRecordDraw_DEFINED 65 #endif//SkRecordDraw_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/record/SkRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698