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

Side by Side Diff: include/private/SkRecords.h

Issue 1261433009: Refugee from Dead Machine 11: Add SkCanvas::drawLitAtlas call Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 7 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 | « include/effects/SkPoint3.h ('k') | include/utils/SkDeferredCanvas.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 #ifndef SkRecords_DEFINED 8 #ifndef SkRecords_DEFINED
9 #define SkRecords_DEFINED 9 #define SkRecords_DEFINED
10 10
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkDrawable.h" 12 #include "SkDrawable.h"
13 #include "SkLight.h"
13 #include "SkMatrix.h" 14 #include "SkMatrix.h"
14 #include "SkPath.h" 15 #include "SkPath.h"
15 #include "SkPicture.h" 16 #include "SkPicture.h"
17 #include "SkPoint3.h"
16 #include "SkRect.h" 18 #include "SkRect.h"
17 #include "SkRRect.h" 19 #include "SkRRect.h"
18 #include "SkRSXform.h" 20 #include "SkRSXform.h"
19 #include "SkTextBlob.h" 21 #include "SkTextBlob.h"
20 22
21 namespace SkRecords { 23 namespace SkRecords {
22 24
23 // A list of all the types of canvas calls we can record. 25 // A list of all the types of canvas calls we can record.
24 // Each of these is reified into a struct below. 26 // Each of these is reified into a struct below.
25 // 27 //
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 M(DrawPoints) \ 60 M(DrawPoints) \
59 M(DrawPosText) \ 61 M(DrawPosText) \
60 M(DrawPosTextH) \ 62 M(DrawPosTextH) \
61 M(DrawText) \ 63 M(DrawText) \
62 M(DrawTextOnPath) \ 64 M(DrawTextOnPath) \
63 M(DrawRRect) \ 65 M(DrawRRect) \
64 M(DrawRect) \ 66 M(DrawRect) \
65 M(DrawSprite) \ 67 M(DrawSprite) \
66 M(DrawTextBlob) \ 68 M(DrawTextBlob) \
67 M(DrawAtlas) \ 69 M(DrawAtlas) \
70 M(DrawLitAtlas) \
68 M(DrawVertices) 71 M(DrawVertices)
69 72
70 // Defines SkRecords::Type, an enum of all record types. 73 // Defines SkRecords::Type, an enum of all record types.
71 #define ENUM(T) T##_Type, 74 #define ENUM(T) T##_Type,
72 enum Type { SK_RECORD_TYPES(ENUM) }; 75 enum Type { SK_RECORD_TYPES(ENUM) };
73 #undef ENUM 76 #undef ENUM
74 77
75 // Macros to make it easier to define a record for a draw call with 0 args, 1 ar gs, 2 args, etc. 78 // Macros to make it easier to define a record for a draw call with 0 args, 1 ar gs, 2 args, etc.
76 // These should be clearer when you look at their use below. 79 // These should be clearer when you look at their use below.
77 #define RECORD0(T) \ 80 #define RECORD0(T) \
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 static const Type kType = T##_Type; \ 136 static const Type kType = T##_Type; \
134 T() {} \ 137 T() {} \
135 template <typename Z, typename Y, typename X, typename W, \ 138 template <typename Z, typename Y, typename X, typename W, \
136 typename V, typename U, typename S, typename R> \ 139 typename V, typename U, typename S, typename R> \
137 T(const Z& a, const Y& b, const X& c, const W& d, \ 140 T(const Z& a, const Y& b, const X& c, const W& d, \
138 const V& e, const U& f, const S& g, const R& h) \ 141 const V& e, const U& f, const S& g, const R& h) \
139 : a(a), b(b), c(c), d(d), e(e), f(f), g(g), h(h) {} \ 142 : a(a), b(b), c(c), d(d), e(e), f(f), g(g), h(h) {} \
140 A a; B b; C c; D d; E e; F f; G g; H h; \ 143 A a; B b; C c; D d; E e; F f; G g; H h; \
141 }; 144 };
142 145
146 #define RECORDB(T, A, a, B, b, C, c, D, d, E, e, F, f, G, g, H, h, I, i, J, j, K , k) \
147 struct T { \
148 static const Type kType = T##_Type; \
149 T() {} \
150 template <typename Z, typename Y, typename X, typename W, \
151 typename V, typename U, typename S, typename R, \
152 typename Q, typename P, typename O> \
153 T(const Z& a, const Y& b, const X& c, const W& d, \
154 const V& e, const U& f, const S& g, const R& h, \
155 const Q& i, const P& j, const O& k) \
156 : a(a), b(b), c(c), d(d), e(e), f(f), g(g), h(h), i(i), j(j), k(k) {} \
157 A a; B b; C c; D d; E e; F f; G g; H h; I i; J j; K k; \
158 };
159
143 #define ACT_AS_PTR(ptr) \ 160 #define ACT_AS_PTR(ptr) \
144 operator T*() const { return ptr; } \ 161 operator T*() const { return ptr; } \
145 T* operator->() const { return ptr; } 162 T* operator->() const { return ptr; }
146 163
147 template <typename T> 164 template <typename T>
148 class RefBox : SkNoncopyable { 165 class RefBox : SkNoncopyable {
149 public: 166 public:
150 RefBox() {} 167 RefBox() {}
151 RefBox(T* obj) : fObj(SkSafeRef(obj)) {} 168 RefBox(T* obj) : fObj(SkSafeRef(obj)) {}
152 ~RefBox() { SkSafeUnref(fObj); } 169 ~RefBox() { SkSafeUnref(fObj); }
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 350
334 RECORD8(DrawAtlas, Optional<SkPaint>, paint, 351 RECORD8(DrawAtlas, Optional<SkPaint>, paint,
335 RefBox<const SkImage>, atlas, 352 RefBox<const SkImage>, atlas,
336 PODArray<SkRSXform>, xforms, 353 PODArray<SkRSXform>, xforms,
337 PODArray<SkRect>, texs, 354 PODArray<SkRect>, texs,
338 PODArray<SkColor>, colors, 355 PODArray<SkColor>, colors,
339 int, count, 356 int, count,
340 SkXfermode::Mode, mode, 357 SkXfermode::Mode, mode,
341 Optional<SkRect>, cull); 358 Optional<SkRect>, cull);
342 359
360 RECORDB(DrawLitAtlas, Optional<SkPaint>, paint,
361 RefBox<const SkImage>, atlas,
362 PODArray<SkRSXform>, xforms,
363 PODArray<SkRect>, diffTexs,
364 PODArray<SkRect>, normTexs,
365 PODArray<SkColor>, colors,
366 int, count,
367 SkXfermode::Mode, mode,
368 Optional<SkRect>, cull,
369 PODArray<SkLight>, lights,
370 int, numLights);
371
343 // This guy is so ugly we just write it manually. 372 // This guy is so ugly we just write it manually.
344 struct DrawVertices { 373 struct DrawVertices {
345 static const Type kType = DrawVertices_Type; 374 static const Type kType = DrawVertices_Type;
346 375
347 DrawVertices(const SkPaint& paint, 376 DrawVertices(const SkPaint& paint,
348 SkCanvas::VertexMode vmode, 377 SkCanvas::VertexMode vmode,
349 int vertexCount, 378 int vertexCount,
350 SkPoint* vertices, 379 SkPoint* vertices,
351 SkPoint* texs, 380 SkPoint* texs,
352 SkColor* colors, 381 SkColor* colors,
(...skipping 25 matching lines...) Expand all
378 #undef RECORD1 407 #undef RECORD1
379 #undef RECORD2 408 #undef RECORD2
380 #undef RECORD3 409 #undef RECORD3
381 #undef RECORD4 410 #undef RECORD4
382 #undef RECORD5 411 #undef RECORD5
383 #undef RECORD8 412 #undef RECORD8
384 413
385 } // namespace SkRecords 414 } // namespace SkRecords
386 415
387 #endif//SkRecords_DEFINED 416 #endif//SkRecords_DEFINED
OLDNEW
« no previous file with comments | « include/effects/SkPoint3.h ('k') | include/utils/SkDeferredCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698