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

Side by Side Diff: gm/dcshader.cpp

Issue 1316513002: Change SkShader;asFragmentProcessor signature to no longer take skpaint\grcolor* (Closed) Base URL: https://skia.googlesource.com/skia.git@things
Patch Set: nullptr Created 5 years, 3 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 | gyp/gpu.gypi » ('j') | include/core/SkShader.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "gm.h" 9 #include "gm.h"
10 #if SK_SUPPORT_GPU 10 #if SK_SUPPORT_GPU
11 #include "GrFragmentProcessor.h" 11 #include "GrFragmentProcessor.h"
12 #include "GrCoordTransform.h" 12 #include "GrCoordTransform.h"
13 #include "effects/GrExtractAlphaFragmentProcessor.h"
13 #include "gl/GrGLProcessor.h" 14 #include "gl/GrGLProcessor.h"
14 #include "gl/builders/GrGLProgramBuilder.h" 15 #include "gl/builders/GrGLProgramBuilder.h"
15 #include "Resources.h" 16 #include "Resources.h"
16 #include "SkReadBuffer.h" 17 #include "SkReadBuffer.h"
17 #include "SkShader.h" 18 #include "SkShader.h"
18 #include "SkStream.h" 19 #include "SkStream.h"
19 #include "SkTypeface.h" 20 #include "SkTypeface.h"
20 #include "SkWriteBuffer.h" 21 #include "SkWriteBuffer.h"
21 22
22 namespace skiagm { 23 namespace skiagm {
23 24
24 /////////////////////////////////////////////////////////////////////////////// 25 ///////////////////////////////////////////////////////////////////////////////
25 26
26 class DCShader : public SkShader { 27 class DCShader : public SkShader {
27 public: 28 public:
28 DCShader(const SkMatrix& matrix) : fDeviceMatrix(matrix) {} 29 DCShader(const SkMatrix& matrix) : fDeviceMatrix(matrix) {}
29 30
30 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DCShader); 31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DCShader);
31 32
32 void flatten(SkWriteBuffer& buf) const override { 33 void flatten(SkWriteBuffer& buf) const override {
33 buf.writeMatrix(fDeviceMatrix); 34 buf.writeMatrix(fDeviceMatrix);
34 } 35 }
35 36
36 bool asFragmentProcessor(GrContext*, const SkPaint& paint, const SkMatrix& v iewM, 37 const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix& v iewM,
robertphillips 2015/08/28 21:33:05 indent ?
bsalomon 2015/08/29 01:42:50 Done.
37 const SkMatrix* localMatrix, GrColor* color, GrProc essorDataManager*, 38 const SkMatrix* localMatrix, SkFilterQuality, GrProcessorDataManager*) c onst override;
38 GrFragmentProcessor** fp) const override;
39 39
40 #ifndef SK_IGNORE_TO_STRING 40 #ifndef SK_IGNORE_TO_STRING
41 void toString(SkString* str) const override { 41 void toString(SkString* str) const override {
42 str->appendf("DCShader: ()"); 42 str->appendf("DCShader: ()");
43 } 43 }
44 #endif 44 #endif
45 45
46 private: 46 private:
47 const SkMatrix fDeviceMatrix; 47 const SkMatrix fDeviceMatrix;
48 }; 48 };
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 private: 88 private:
89 void onGetGLProcessorKey(const GrGLSLCaps& caps, 89 void onGetGLProcessorKey(const GrGLSLCaps& caps,
90 GrProcessorKeyBuilder* b) const override {} 90 GrProcessorKeyBuilder* b) const override {}
91 91
92 bool onIsEqual(const GrFragmentProcessor&) const override { return true; } 92 bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
93 93
94 GrCoordTransform fDeviceTransform; 94 GrCoordTransform fDeviceTransform;
95 }; 95 };
96 96
97 bool DCShader::asFragmentProcessor(GrContext*, const SkPaint& paint, const SkMat rix& viewM, 97 const GrFragmentProcessor* DCShader::asFragmentProcessor(GrContext*, const SkMat rix& viewM,
robertphillips 2015/08/28 21:33:05 indent ?
bsalomon 2015/08/29 01:42:49 Done.
98 const SkMatrix* localMatrix, GrColor* color, 98 const SkMatrix* localMatrix, SkFilterQuality, GrProcessorDataManager* procDa taManager) const {
99 GrProcessorDataManager* procDataManager, 99 SkAutoTUnref<const GrFragmentProcessor> inner(new DCFP(procDataManager, fDev iceMatrix));
100 GrFragmentProcessor** fp) const { 100 return GrExtractAlphaFragmentProcessor::Create(inner);
101 *fp = new DCFP(procDataManager, fDeviceMatrix);
102 *color = GrColorPackA4(paint.getAlpha());
103 return true;
104 } 101 }
105 102
106 class DCShaderGM : public GM { 103 class DCShaderGM : public GM {
107 public: 104 public:
108 DCShaderGM() { 105 DCShaderGM() {
109 this->setBGColor(sk_tool_utils::color_to_565(0xFFAABBCC)); 106 this->setBGColor(sk_tool_utils::color_to_565(0xFFAABBCC));
110 } 107 }
111 108
112 ~DCShaderGM() override { 109 ~DCShaderGM() override {
113 for (int i = 0; i < fPrims.count(); ++i) { 110 for (int i = 0; i < fPrims.count(); ++i) {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 }; 284 };
288 285
289 SkTArray<Prim*> fPrims; 286 SkTArray<Prim*> fPrims;
290 287
291 typedef GM INHERITED; 288 typedef GM INHERITED;
292 }; 289 };
293 290
294 DEF_GM(return new DCShaderGM;) 291 DEF_GM(return new DCShaderGM;)
295 } 292 }
296 #endif 293 #endif
OLDNEW
« no previous file with comments | « no previous file | gyp/gpu.gypi » ('j') | include/core/SkShader.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698