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

Side by Side Diff: include/core/SkComposeShader.h

Issue 1697523003: make SkComposeShader.h private (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 | « gyp/core.gypi ('k') | samplecode/PerlinPatch.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1
2 /*
3 * Copyright 2006 The Android Open Source Project
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9
10 #ifndef SkComposeShader_DEFINED
11 #define SkComposeShader_DEFINED
12
13 #include "SkShader.h"
14
15 class SkXfermode;
16
17 //////////////////////////////////////////////////////////////////////////////// ///////////
18
19 /** \class SkComposeShader
20 This subclass of shader returns the composition of two other shaders, combin ed by
21 a xfermode.
22 */
23 class SK_API SkComposeShader : public SkShader {
24 public:
25 /** Create a new compose shader, given shaders A, B, and a combining xfermod e mode.
26 When the xfermode is called, it will be given the result from shader A a s its
27 "dst", and the result from shader B as its "src".
28 mode->xfer32(sA_result, sB_result, ...)
29 @param shaderA The colors from this shader are seen as the "dst" by the xfermode
30 @param shaderB The colors from this shader are seen as the "src" by the xfermode
31 @param mode The xfermode that combines the colors from the two shade rs. If mode
32 is null, then SRC_OVER is assumed.
33 */
34 SkComposeShader(SkShader* sA, SkShader* sB, SkXfermode* mode = NULL);
35 virtual ~SkComposeShader();
36
37 size_t contextSize() const override;
38
39 #if SK_SUPPORT_GPU
40 const GrFragmentProcessor* asFragmentProcessor(GrContext*,
41 const SkMatrix& viewM,
42 const SkMatrix* localMatrix,
43 SkFilterQuality) const overr ide;
44 #endif
45
46 class ComposeShaderContext : public SkShader::Context {
47 public:
48 // When this object gets destroyed, it will call contextA and contextB's destructor
49 // but it will NOT free the memory.
50 ComposeShaderContext(const SkComposeShader&, const ContextRec&,
51 SkShader::Context* contextA, SkShader::Context* con textB);
52
53 SkShader::Context* getShaderContextA() const { return fShaderContextA; }
54 SkShader::Context* getShaderContextB() const { return fShaderContextB; }
55
56 virtual ~ComposeShaderContext();
57
58 void shadeSpan(int x, int y, SkPMColor[], int count) override;
59
60 private:
61 SkShader::Context* fShaderContextA;
62 SkShader::Context* fShaderContextB;
63
64 typedef SkShader::Context INHERITED;
65 };
66
67 #ifdef SK_DEBUG
68 SkShader* getShaderA() { return fShaderA; }
69 SkShader* getShaderB() { return fShaderB; }
70 #endif
71
72 bool asACompose(ComposeRec* rec) const override;
73
74 SK_TO_STRING_OVERRIDE()
75 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeShader)
76
77 protected:
78 SkComposeShader(SkReadBuffer& );
79 void flatten(SkWriteBuffer&) const override;
80 Context* onCreateContext(const ContextRec&, void*) const override;
81
82 private:
83 SkShader* fShaderA;
84 SkShader* fShaderB;
85 SkXfermode* fMode;
86
87 typedef SkShader INHERITED;
88 };
89
90 #endif
OLDNEW
« no previous file with comments | « gyp/core.gypi ('k') | samplecode/PerlinPatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698