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

Side by Side Diff: src/pdf/SkPDFShader.h

Issue 841763005: Generic PDF shader fallback (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: win build fix Created 5 years, 11 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/pdf/SkPDFDevice.cpp ('k') | src/pdf/SkPDFShader.cpp » ('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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 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 9
10 #ifndef SkPDFShader_DEFINED 10 #ifndef SkPDFShader_DEFINED
(...skipping 15 matching lines...) Expand all
26 */ 26 */
27 27
28 class SkPDFShader { 28 class SkPDFShader {
29 public: 29 public:
30 /** Get the PDF shader for the passed SkShader. If the SkShader is 30 /** Get the PDF shader for the passed SkShader. If the SkShader is
31 * invalid in some way, returns NULL. The reference count of 31 * invalid in some way, returns NULL. The reference count of
32 * the object is incremented and it is the caller's responsibility to 32 * the object is incremented and it is the caller's responsibility to
33 * unreference it when done. This is needed to accommodate the weak 33 * unreference it when done. This is needed to accommodate the weak
34 * reference pattern used when the returned object is new and has no 34 * reference pattern used when the returned object is new and has no
35 * other references. 35 * other references.
36 * @param shader The SkShader to emulate. 36 * @param shader The SkShader to emulate.
37 * @param matrix The current transform. (PDF shaders are absolutely 37 * @param matrix The current transform. (PDF shaders are absolutely
38 * positioned, relative to where the page is drawn.) 38 * positioned, relative to where the page is drawn.)
39 * @param surfceBBox The bounding box of the drawing surface (with matrix 39 * @param surfceBBox The bounding box of the drawing surface (with matrix
40 * already applied). 40 * already applied).
41 * @param rasterScale Additional scale to be applied for early rasterizatio n.
41 */ 42 */
42 static SkPDFObject* GetPDFShader(const SkShader& shader, 43 static SkPDFObject* GetPDFShader(const SkShader& shader,
43 const SkMatrix& matrix, 44 const SkMatrix& matrix,
44 const SkIRect& surfaceBBox); 45 const SkIRect& surfaceBBox,
46 SkScalar rasterScale);
45 47
46 protected: 48 protected:
47 class State; 49 class State;
48 50
49 class ShaderCanonicalEntry { 51 class ShaderCanonicalEntry {
50 public: 52 public:
51 ShaderCanonicalEntry(SkPDFObject* pdfShader, const State* state); 53 ShaderCanonicalEntry(SkPDFObject* pdfShader, const State* state);
52 bool operator==(const ShaderCanonicalEntry& b) const; 54 bool operator==(const ShaderCanonicalEntry& b) const;
53 55
54 SkPDFObject* fPDFShader; 56 SkPDFObject* fPDFShader;
55 const State* fState; 57 const State* fState;
56 }; 58 };
57 // This should be made a hash table if performance is a problem. 59 // This should be made a hash table if performance is a problem.
58 static SkTDArray<ShaderCanonicalEntry>& CanonicalShaders(); 60 static SkTDArray<ShaderCanonicalEntry>& CanonicalShaders();
59 static SkBaseMutex& CanonicalShadersMutex(); 61 static SkBaseMutex& CanonicalShadersMutex();
60 62
61 // This is an internal method. 63 // This is an internal method.
62 // CanonicalShadersMutex() should already be acquired. 64 // CanonicalShadersMutex() should already be acquired.
63 // This also takes ownership of shaderState. 65 // This also takes ownership of shaderState.
64 static SkPDFObject* GetPDFShaderByState(State* shaderState); 66 static SkPDFObject* GetPDFShaderByState(State* shaderState);
65 static void RemoveShader(SkPDFObject* shader); 67 static void RemoveShader(SkPDFObject* shader);
66 68
67 SkPDFShader(); 69 SkPDFShader();
68 virtual ~SkPDFShader() {}; 70 virtual ~SkPDFShader() {};
69 71
70 virtual bool isValid() = 0; 72 virtual bool isValid() = 0;
71 }; 73 };
72 74
73 #endif 75 #endif
OLDNEW
« no previous file with comments | « src/pdf/SkPDFDevice.cpp ('k') | src/pdf/SkPDFShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698