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

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

Issue 179343005: Add a class to allocate small objects w/o extra calls to new. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rename the .h file Created 6 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
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 16
16 class SkBitmapProcShader : public SkShader { 17 class SkBitmapProcShader : public SkShader {
17 public: 18 public:
18 SkBitmapProcShader(const SkBitmap& src, TileMode tx, TileMode ty); 19 SkBitmapProcShader(const SkBitmap& src, TileMode tx, TileMode ty);
19 20
20 // overrides from SkShader 21 // overrides from SkShader
21 virtual bool isOpaque() const SK_OVERRIDE; 22 virtual bool isOpaque() const SK_OVERRIDE;
22 virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&) SK _OVERRIDE; 23 virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&) SK _OVERRIDE;
23 virtual void endContext() SK_OVERRIDE; 24 virtual void endContext() SK_OVERRIDE;
24 virtual uint32_t getFlags() SK_OVERRIDE { return fFlags; } 25 virtual uint32_t getFlags() SK_OVERRIDE { return fFlags; }
(...skipping 16 matching lines...) Expand all
41 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 42 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
42 43
43 SkBitmap fRawBitmap; // experimental for RLE encoding 44 SkBitmap fRawBitmap; // experimental for RLE encoding
44 SkBitmapProcState fState; 45 SkBitmapProcState fState;
45 uint32_t fFlags; 46 uint32_t fFlags;
46 47
47 private: 48 private:
48 typedef SkShader INHERITED; 49 typedef SkShader INHERITED;
49 }; 50 };
50 51
52 // Commonly used allocator. It currently is only used to allocate up to 2 object s. The total
53 // bytes requested is calculated using one of our large shaders plus the size of an Sk3DBlitter
54 // in SkDraw.cpp
55 typedef SkSmallAllocator<2, sizeof(SkBitmapProcShader) + sizeof(void*) * 2> SkTB litterAllocator;
56
57 // If alloc is non-NULL, it will be used to allocate the returned SkShader, and MUST outlive
58 // the SkShader.
59 SkShader* CreateBitmapShader(const SkBitmap& src, SkShader::TileMode, SkShader:: TileMode,
60 SkTBlitterAllocator* alloc);
61
51 #endif 62 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698