Chromium Code Reviews

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: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 "SkStackAllocator.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...)
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 #define kBlitterStorageByteCount (sizeof(SkBitmapProcShader))
53
54 // If alloc is non-NULL, it will be used to allocate the returned SkShader, and MUST outlive
55 // the SkShader.
56 SkShader* CreateBitmapShader(const SkBitmap& src, SkShader::TileMode, SkShader:: TileMode,
57 SkStackAllocator<kBlitterStorageByteCount>* alloc);
58
51 #endif 59 #endif
OLDNEW
« no previous file with comments | « include/core/SkShader.h ('k') | src/core/SkBitmapProcShader.cpp » ('j') | src/core/SkBlitter.cpp » ('J')

Powered by Google App Engine