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

Side by Side Diff: src/core/SkPictureCommon.h

Issue 1287263005: change asABitmap to isABitmap on shader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 // Some shared code used by both SkBigPicture and SkMiniPicture. 8 // Some shared code used by both SkBigPicture and SkMiniPicture.
9 // SkTextHunter -- SkRecord visitor that returns true when the op draws text . 9 // SkTextHunter -- SkRecord visitor that returns true when the op draws text .
10 // SkBitmapHunter -- SkRecord visitor that returns true when the op draws a bi tmap. 10 // SkBitmapHunter -- SkRecord visitor that returns true when the op draws a bi tmap.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // If not, look for one in its paint (if it has a paint). 52 // If not, look for one in its paint (if it has a paint).
53 template <typename T> 53 template <typename T>
54 static SK_WHEN(!HasMember_bitmap<T>, bool) CheckBitmap(const T& r) { return CheckPaint(r); } 54 static SK_WHEN(!HasMember_bitmap<T>, bool) CheckBitmap(const T& r) { return CheckPaint(r); }
55 55
56 // If we have a paint, dig down into the effects looking for a bitmap. 56 // If we have a paint, dig down into the effects looking for a bitmap.
57 template <typename T> 57 template <typename T>
58 static SK_WHEN(HasMember_paint<T>, bool) CheckPaint(const T& r) { 58 static SK_WHEN(HasMember_paint<T>, bool) CheckPaint(const T& r) {
59 const SkPaint* paint = AsPtr(r.paint); 59 const SkPaint* paint = AsPtr(r.paint);
60 if (paint) { 60 if (paint) {
61 const SkShader* shader = paint->getShader(); 61 const SkShader* shader = paint->getShader();
62 if (shader && 62 if (shader && shader->isABitmap()) {
63 shader->asABitmap(nullptr, nullptr, nullptr) == SkShader::kDefau lt_BitmapType) {
64 return true; 63 return true;
65 } 64 }
66 } 65 }
67 return false; 66 return false;
68 } 67 }
69 68
70 // If we don't have a paint, that non-paint has no bitmap. 69 // If we don't have a paint, that non-paint has no bitmap.
71 template <typename T> 70 template <typename T>
72 static SK_WHEN(!HasMember_paint<T>, bool) CheckPaint(const T&) { return fals e; } 71 static SK_WHEN(!HasMember_paint<T>, bool) CheckPaint(const T&) { return fals e; }
73 }; 72 };
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 template <typename T> 126 template <typename T>
128 SK_WHEN(HasMember_paint<T>, void) operator()(const T& op) { 127 SK_WHEN(HasMember_paint<T>, void) operator()(const T& op) {
129 this->checkPaint(AsPtr(op.paint)); 128 this->checkPaint(AsPtr(op.paint));
130 } 129 }
131 130
132 template <typename T> 131 template <typename T>
133 SK_WHEN(!HasMember_paint<T>, void) operator()(const T& op) { /* do nothing * / } 132 SK_WHEN(!HasMember_paint<T>, void) operator()(const T& op) { /* do nothing * / }
134 133
135 int fNumSlowPathsAndDashEffects; 134 int fNumSlowPathsAndDashEffects;
136 }; 135 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698