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

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

Issue 1763743002: Revert of add support for new bitmapshader context (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « gm/SkLinearBitmapPipelineGM.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 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 #ifndef SkBitmapProcShader_DEFINED 8 #ifndef SkBitmapProcShader_DEFINED
9 #define SkBitmapProcShader_DEFINED 9 #define SkBitmapProcShader_DEFINED
10 10
11 #include "SkShader.h" 11 #include "SkShader.h"
12 #include "SkSmallAllocator.h" 12 #include "SkSmallAllocator.h"
13 13
14 struct SkBitmapProcState; 14 struct SkBitmapProcState;
15 class SkBitmapProvider; 15 class SkBitmapProvider;
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 = nullptr); 20 const SkMatrix* localMatrix = nullptr);
21 21
22 bool isOpaque() const override; 22 bool isOpaque() const override;
23 23
24 size_t contextSize(const ContextRec& rec) const override { 24 size_t contextSize(const ContextRec& rec) const override { return ContextSiz e(rec); }
25 return ContextSize(rec, fRawBitmap.info());
26 }
27 25
28 SK_TO_STRING_OVERRIDE() 26 SK_TO_STRING_OVERRIDE()
29 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapProcShader) 27 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapProcShader)
30 28
31 #if SK_SUPPORT_GPU 29 #if SK_SUPPORT_GPU
32 const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix& v iewM, 30 const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix& v iewM,
33 const SkMatrix*, SkFilterQual ity) const override; 31 const SkMatrix*, SkFilterQual ity) const override;
34 #endif 32 #endif
35 33
36 protected: 34 protected:
37 void flatten(SkWriteBuffer&) const override; 35 void flatten(SkWriteBuffer&) const override;
38 Context* onCreateContext(const ContextRec&, void* storage) const override; 36 Context* onCreateContext(const ContextRec&, void* storage) const override;
39 bool onIsABitmap(SkBitmap*, SkMatrix*, TileMode*) const override; 37 bool onIsABitmap(SkBitmap*, SkMatrix*, TileMode*) const override;
40 38
41 SkBitmap fRawBitmap; 39 SkBitmap fRawBitmap; // experimental for RLE encoding
42 uint8_t fTileModeX, fTileModeY; 40 uint8_t fTileModeX, fTileModeY;
43 41
44 private: 42 private:
45 friend class SkImageShader; 43 friend class SkImageShader;
46 44
47 static size_t ContextSize(const ContextRec&, const SkImageInfo& srcInfo); 45 static size_t ContextSize(const ContextRec&);
48 static Context* MakeContext(const SkShader&, TileMode tmx, TileMode tmy, 46 static Context* MakeContext(const SkShader&, TileMode tmx, TileMode tmy,
49 const SkBitmapProvider&, const ContextRec&, void * storage); 47 const SkBitmapProvider&, const ContextRec&, void * storage);
50 48
51 typedef SkShader INHERITED; 49 typedef SkShader INHERITED;
52 }; 50 };
53 51
54 // Commonly used allocator. It currently is only used to allocate up to 3 object s. The total 52 // Commonly used allocator. It currently is only used to allocate up to 3 object s. The total
55 // bytes requested is calculated using one of our large shaders, its context siz e plus the size of 53 // bytes requested is calculated using one of our large shaders, its context siz e plus the size of
56 // an Sk3DBlitter in SkDraw.cpp 54 // an Sk3DBlitter in SkDraw.cpp
57 // Note that some contexts may contain other contexts (e.g. for compose shaders) , but we've not 55 // Note that some contexts may contain other contexts (e.g. for compose shaders) , but we've not
58 // yet found a situation where the size below isn't big enough. 56 // yet found a situation where the size below isn't big enough.
59 typedef SkSmallAllocator<3, 2100> SkTBlitterAllocator; 57 typedef SkSmallAllocator<3, 1500> SkTBlitterAllocator;
60 58
61 // If alloc is non-nullptr, it will be used to allocate the returned SkShader, a nd MUST outlive 59 // If alloc is non-nullptr, it will be used to allocate the returned SkShader, a nd MUST outlive
62 // the SkShader. 60 // the SkShader.
63 SkShader* SkCreateBitmapShader(const SkBitmap& src, SkShader::TileMode, SkShader ::TileMode, 61 SkShader* SkCreateBitmapShader(const SkBitmap& src, SkShader::TileMode, SkShader ::TileMode,
64 const SkMatrix* localMatrix, SkTBlitterAllocator* alloc); 62 const SkMatrix* localMatrix, SkTBlitterAllocator* alloc);
65 63
66 #endif 64 #endif
OLDNEW
« no previous file with comments | « gm/SkLinearBitmapPipelineGM.cpp ('k') | src/core/SkBitmapProcShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698