diff options
author | msarett <msarett@google.com> | 2015-11-11 06:21:27 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-11 06:21:27 -0800 |
commit | 49115b57cb9d260ddd49a6905ee87af63b3ab066 (patch) | |
tree | ebb17a38b122102c2998b156fd8161ee4a107f63 /tools | |
parent | 84a80652752976c9abe42d28e467c362baff3e39 (diff) |
Add an Allocator interface that indicates if memory is zero init
This is the first step in a three part change:
(1) Skia: Add SkBRDAllocator.
(2) Android: Make JavaPixelAllocator and RecyclingClippingPixelAllocator
implement SkBRDAllocator.
(3) Skia: Change SkBitmapRegionDecoder to use SkBRDAllocator and take
advantage of zero allocated memory when possible.
BUG=skia:
Review URL: https://codereview.chromium.org/1423253004
Diffstat (limited to 'tools')
-rw-r--r-- | tools/android/SkBRDAllocator.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/android/SkBRDAllocator.h b/tools/android/SkBRDAllocator.h new file mode 100644 index 0000000000..d587c03f49 --- /dev/null +++ b/tools/android/SkBRDAllocator.h @@ -0,0 +1,24 @@ +/* + * Copyright 2015 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "SkBitmap.h" +#include "SkCodec.h" + +/** + * Abstract subclass of SkBitmap's allocator. + * Allows the allocator to indicate if the memory it allocates + * is zero initialized. + */ +class SkBRDAllocator : public SkBitmap::Allocator { +public: + + /** + * Indicates if the memory allocated by this allocator is + * zero initialized. + */ + virtual SkCodec::ZeroInitialized zeroInit() const = 0; +}; |