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

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

Issue 371023005: Add always-threaded SkRecord quilt tests. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: bigger tile -> more GMs can quilt Created 6 years, 5 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/SkCanvas.cpp ('k') | no next file » | 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 9
10 void SkRecordDraw(const SkRecord& record, SkCanvas* canvas, SkDrawPictureCallbac k* callback) { 10 void SkRecordDraw(const SkRecord& record, SkCanvas* canvas, SkDrawPictureCallbac k* callback) {
(...skipping 13 matching lines...) Expand all
24 fIndex += r.skip; 24 fIndex += r.skip;
25 return true; 25 return true;
26 } 26 }
27 return false; 27 return false;
28 } 28 }
29 29
30 bool Draw::skip(const BoundedDrawPosTextH& r) { 30 bool Draw::skip(const BoundedDrawPosTextH& r) {
31 return fCanvas->quickRejectY(r.minY, r.maxY); 31 return fCanvas->quickRejectY(r.minY, r.maxY);
32 } 32 }
33 33
34 // FIXME: SkBitmaps are stateful, so we need to copy them to play back in multip le threads.
35 static SkBitmap shallow_copy(const SkBitmap& bitmap) {
36 return bitmap;
37 }
38
34 // NoOps draw nothing. 39 // NoOps draw nothing.
35 template <> void Draw::draw(const NoOp&) {} 40 template <> void Draw::draw(const NoOp&) {}
36 41
37 #define DRAW(T, call) template <> void Draw::draw(const T& r) { fCanvas->call; } 42 #define DRAW(T, call) template <> void Draw::draw(const T& r) { fCanvas->call; }
38 DRAW(Restore, restore()); 43 DRAW(Restore, restore());
39 DRAW(Save, save()); 44 DRAW(Save, save());
40 DRAW(SaveLayer, saveLayer(r.bounds, r.paint, r.flags)); 45 DRAW(SaveLayer, saveLayer(r.bounds, r.paint, r.flags));
41 DRAW(PopCull, popCull()); 46 DRAW(PopCull, popCull());
42 DRAW(PushCull, pushCull(r.rect)); 47 DRAW(PushCull, pushCull(r.rect));
43 DRAW(Clear, clear(r.color)); 48 DRAW(Clear, clear(r.color));
44 DRAW(Concat, concat(r.matrix)); 49 DRAW(Concat, concat(r.matrix));
45 DRAW(SetMatrix, setMatrix(SkMatrix::Concat(fInitialCTM, r.matrix))); 50 DRAW(SetMatrix, setMatrix(SkMatrix::Concat(fInitialCTM, r.matrix)));
46 51
47 DRAW(ClipPath, clipPath(r.path, r.op, r.doAA)); 52 DRAW(ClipPath, clipPath(r.path, r.op, r.doAA));
48 DRAW(ClipRRect, clipRRect(r.rrect, r.op, r.doAA)); 53 DRAW(ClipRRect, clipRRect(r.rrect, r.op, r.doAA));
49 DRAW(ClipRect, clipRect(r.rect, r.op, r.doAA)); 54 DRAW(ClipRect, clipRect(r.rect, r.op, r.doAA));
50 DRAW(ClipRegion, clipRegion(r.region, r.op)); 55 DRAW(ClipRegion, clipRegion(r.region, r.op));
51 56
52 DRAW(DrawBitmap, drawBitmap(r.bitmap, r.left, r.top, r.paint)); 57 DRAW(DrawBitmap, drawBitmap(shallow_copy(r.bitmap), r.left, r.top, r.paint));
53 DRAW(DrawBitmapMatrix, drawBitmapMatrix(r.bitmap, r.matrix, r.paint)); 58 DRAW(DrawBitmapMatrix, drawBitmapMatrix(shallow_copy(r.bitmap), r.matrix, r.pain t));
54 DRAW(DrawBitmapNine, drawBitmapNine(r.bitmap, r.center, r.dst, r.paint)); 59 DRAW(DrawBitmapNine, drawBitmapNine(shallow_copy(r.bitmap), r.center, r.dst, r.p aint));
55 DRAW(DrawBitmapRectToRect, drawBitmapRectToRect(r.bitmap, r.src, r.dst, r.paint, r.flags)); 60 DRAW(DrawBitmapRectToRect,
61 drawBitmapRectToRect(shallow_copy(r.bitmap), r.src, r.dst, r.paint, r.fl ags));
56 DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint)); 62 DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint));
57 DRAW(DrawOval, drawOval(r.oval, r.paint)); 63 DRAW(DrawOval, drawOval(r.oval, r.paint));
58 DRAW(DrawPaint, drawPaint(r.paint)); 64 DRAW(DrawPaint, drawPaint(r.paint));
59 DRAW(DrawPath, drawPath(r.path, r.paint)); 65 DRAW(DrawPath, drawPath(r.path, r.paint));
60 DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint)); 66 DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint));
61 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); 67 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint));
62 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); 68 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint));
63 DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); 69 DRAW(DrawRRect, drawRRect(r.rrect, r.paint));
64 DRAW(DrawRect, drawRect(r.rect, r.paint)); 70 DRAW(DrawRect, drawRect(r.rect, r.paint));
65 DRAW(DrawSprite, drawSprite(r.bitmap, r.left, r.top, r.paint)); 71 DRAW(DrawSprite, drawSprite(shallow_copy(r.bitmap), r.left, r.top, r.paint));
66 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); 72 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint));
67 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, r.matrix, r.pa int)); 73 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, r.matrix, r.pa int));
68 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co lors, 74 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co lors,
69 r.xmode.get(), r.indices, r.indexCount, r.paint) ); 75 r.xmode.get(), r.indices, r.indexCount, r.paint) );
70 #undef DRAW 76 #undef DRAW
71 77
72 template <> void Draw::draw(const PairedPushCull& r) { this->draw(*r.base); } 78 template <> void Draw::draw(const PairedPushCull& r) { this->draw(*r.base); }
73 template <> void Draw::draw(const BoundedDrawPosTextH& r) { this->draw(*r.base); } 79 template <> void Draw::draw(const BoundedDrawPosTextH& r) { this->draw(*r.base); }
74 80
75 } // namespace SkRecords 81 } // namespace SkRecords
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698