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

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

Issue 452983002: SkRecord: Strip out cull-skipping and y-only drawPosTextH skipping. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove dead code. Created 6 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/SkRecordDraw.h ('k') | src/core/SkRecordOpts.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 "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) {
11 SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/); 11 SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
12 for (SkRecords::Draw draw(canvas); draw.index() < record.count(); draw.next( )) { 12 for (SkRecords::Draw draw(canvas); draw.index() < record.count(); draw.next( )) {
13 if (NULL != callback && callback->abortDrawing()) { 13 if (NULL != callback && callback->abortDrawing()) {
14 return; 14 return;
15 } 15 }
16 record.visit<void>(draw.index(), draw); 16 record.visit<void>(draw.index(), draw);
17 } 17 }
18 } 18 }
19 19
20 namespace SkRecords { 20 namespace SkRecords {
21 21
22 bool Draw::skip(const PairedPushCull& r) {
23 if (fCanvas->quickReject(r.base->rect)) {
24 fIndex += r.skip;
25 return true;
26 }
27 return false;
28 }
29
30 bool Draw::skip(const BoundedDrawPosTextH& r) {
31 return fCanvas->quickRejectY(r.minY, r.maxY);
32 }
33
34 // FIXME: SkBitmaps are stateful, so we need to copy them to play back in multip le threads. 22 // 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) { 23 static SkBitmap shallow_copy(const SkBitmap& bitmap) {
36 return bitmap; 24 return bitmap;
37 } 25 }
38 26
39 // NoOps draw nothing. 27 // NoOps draw nothing.
40 template <> void Draw::draw(const NoOp&) {} 28 template <> void Draw::draw(const NoOp&) {}
41 29
42 #define DRAW(T, call) template <> void Draw::draw(const T& r) { fCanvas->call; } 30 #define DRAW(T, call) template <> void Draw::draw(const T& r) { fCanvas->call; }
43 DRAW(Restore, restore()); 31 DRAW(Restore, restore());
(...skipping 26 matching lines...) Expand all
70 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); 58 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint));
71 DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); 59 DRAW(DrawRRect, drawRRect(r.rrect, r.paint));
72 DRAW(DrawRect, drawRect(r.rect, r.paint)); 60 DRAW(DrawRect, drawRect(r.rect, r.paint));
73 DRAW(DrawSprite, drawSprite(shallow_copy(r.bitmap), r.left, r.top, r.paint)); 61 DRAW(DrawSprite, drawSprite(shallow_copy(r.bitmap), r.left, r.top, r.paint));
74 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); 62 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint));
75 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, r.matrix, r.pa int)); 63 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, r.matrix, r.pa int));
76 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co lors, 64 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co lors,
77 r.xmode.get(), r.indices, r.indexCount, r.paint) ); 65 r.xmode.get(), r.indices, r.indexCount, r.paint) );
78 #undef DRAW 66 #undef DRAW
79 67
80 template <> void Draw::draw(const PairedPushCull& r) { this->draw(*r.base); }
81 template <> void Draw::draw(const BoundedDrawPosTextH& r) { this->draw(*r.base); }
82
83 } // namespace SkRecords 68 } // namespace SkRecords
OLDNEW
« no previous file with comments | « src/core/SkRecordDraw.h ('k') | src/core/SkRecordOpts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698