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

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

Issue 1245883003: Move LightingShader to effects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address 64b gcc memory issues (seems to require more space than others) 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
« no previous file with comments | « samplecode/SampleLighting.cpp ('k') | src/core/SkBitmapProcShader.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 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
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 SkBitmapProcShader_DEFINED 10 #ifndef SkBitmapProcShader_DEFINED
11 #define SkBitmapProcShader_DEFINED 11 #define SkBitmapProcShader_DEFINED
12 12
13 #include "SkShader.h" 13 #include "SkShader.h"
14 #include "SkBitmapProcState.h" 14 #include "SkBitmapProcState.h"
15 #include "SkSmallAllocator.h" 15 #include "SkSmallAllocator.h"
16 16
17 class SkBitmapProcShader : public SkShader { 17 class SkBitmapProcShader : public SkShader {
18 public: 18 public:
19 SkBitmapProcShader(const SkBitmap& src, TileMode tx, TileMode ty, 19 SkBitmapProcShader(const SkBitmap& src, TileMode tx, TileMode ty,
20 const SkMatrix* localMatrix = NULL); 20 const SkMatrix* localMatrix = NULL);
21 21
22 // overrides from SkShader 22 // overrides from SkShader
23 bool isOpaque() const override; 23 bool isOpaque() const override;
24 BitmapType asABitmap(SkBitmap*, SkMatrix*, TileMode*) const override; 24 BitmapType asABitmap(SkBitmap*, SkMatrix*, TileMode*) const override;
25 25
26 size_t contextSize() const override; 26 size_t contextSize() const override;
27 27
28 static bool CanDo(const SkBitmap&, TileMode tx, TileMode ty);
29
30 SK_TO_STRING_OVERRIDE() 28 SK_TO_STRING_OVERRIDE()
31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapProcShader) 29 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapProcShader)
32 30
33 31
34 bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix& viewM, const SkMatrix*, 32 bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix& viewM, const SkMatrix*,
35 GrColor*, GrProcessorDataManager*, 33 GrColor*, GrProcessorDataManager*,
36 GrFragmentProcessor**) const override; 34 GrFragmentProcessor**) const override;
37 35
38 class BitmapProcShaderContext : public SkShader::Context { 36 class BitmapProcShaderContext : public SkShader::Context {
39 public: 37 public:
40 // The context takes ownership of the state. It will call its destructor 38 // The context takes ownership of the state. It will call its destructor
41 // but will NOT free the memory. 39 // but will NOT free the memory.
42 BitmapProcShaderContext(const SkBitmapProcShader&, const ContextRec&, Sk BitmapProcState*); 40 BitmapProcShaderContext(const SkBitmapProcShader&, const ContextRec&, Sk BitmapProcState*);
43 virtual ~BitmapProcShaderContext(); 41 ~BitmapProcShaderContext() override;
44 42
45 void shadeSpan(int x, int y, SkPMColor dstC[], int count) override; 43 void shadeSpan(int x, int y, SkPMColor dstC[], int count) override;
46 ShadeProc asAShadeProc(void** ctx) override; 44 ShadeProc asAShadeProc(void** ctx) override;
47 void shadeSpan16(int x, int y, uint16_t dstC[], int count) override; 45 void shadeSpan16(int x, int y, uint16_t dstC[], int count) override;
48 46
49 uint32_t getFlags() const override { return fFlags; } 47 uint32_t getFlags() const override { return fFlags; }
50 48
51 private: 49 private:
52 SkBitmapProcState* fState; 50 SkBitmapProcState* fState;
53 uint32_t fFlags; 51 uint32_t fFlags;
(...skipping 10 matching lines...) Expand all
64 62
65 private: 63 private:
66 typedef SkShader INHERITED; 64 typedef SkShader INHERITED;
67 }; 65 };
68 66
69 // Commonly used allocator. It currently is only used to allocate up to 3 object s. The total 67 // Commonly used allocator. It currently is only used to allocate up to 3 object s. The total
70 // bytes requested is calculated using one of our large shaders, its context siz e plus the size of 68 // bytes requested is calculated using one of our large shaders, its context siz e plus the size of
71 // an Sk3DBlitter in SkDraw.cpp 69 // an Sk3DBlitter in SkDraw.cpp
72 // Note that some contexts may contain other contexts (e.g. for compose shaders) , but we've not 70 // Note that some contexts may contain other contexts (e.g. for compose shaders) , but we've not
73 // yet found a situation where the size below isn't big enough. 71 // yet found a situation where the size below isn't big enough.
74 typedef SkSmallAllocator<3, 1024> SkTBlitterAllocator; 72 typedef SkSmallAllocator<3, 1152> SkTBlitterAllocator;
75 73
76 // If alloc is non-NULL, it will be used to allocate the returned SkShader, and MUST outlive 74 // If alloc is non-NULL, it will be used to allocate the returned SkShader, and MUST outlive
77 // the SkShader. 75 // the SkShader.
78 SkShader* SkCreateBitmapShader(const SkBitmap& src, SkShader::TileMode, SkShader ::TileMode, 76 SkShader* SkCreateBitmapShader(const SkBitmap& src, SkShader::TileMode, SkShader ::TileMode,
79 const SkMatrix* localMatrix, SkTBlitterAllocator* alloc); 77 const SkMatrix* localMatrix, SkTBlitterAllocator* alloc);
80 78
81 #endif 79 #endif
OLDNEW
« no previous file with comments | « samplecode/SampleLighting.cpp ('k') | src/core/SkBitmapProcShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698