Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>.
[chromium-blink-merge.git] / skia / ext / lazy_pixel_ref.h
blobb3f704d2f19ef8000f11a33bdbb58a616b8173ff
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef SKIA_EXT_LAZY_PIXEL_REF_H_
6 #define SKIA_EXT_LAZY_PIXEL_REF_H_
8 #include "third_party/skia/include/core/SkPixelRef.h"
9 #include "third_party/skia/include/core/SkRect.h"
11 namespace skia {
13 // This class extends SkPixelRef to facilitate lazy image decoding on the impl
14 // thread.
15 class SK_API LazyPixelRef : public SkPixelRef {
16 public:
17 explicit LazyPixelRef(const SkImageInfo& info);
18 virtual ~LazyPixelRef();
20 struct PrepareParams {
21 // Clipping rect for this pixel ref.
22 SkIRect clip_rect;
25 // Request the ImageDecodingStore to prepare image decoding for the
26 // given clipping rect. Returns true is succeeded, or false otherwise.
27 virtual bool PrepareToDecode(const PrepareParams& params) = 0;
29 // Returns true if this pixel ref is already in the ImageDecodingStore's
30 // cache, false otherwise. Much cheaper than PrepareToDecode().
31 virtual bool MaybeDecoded() = 0;
33 // Start decoding the image.
34 virtual void Decode() = 0;
37 } // namespace skia
39 #endif // SKIA_EXT_LAZY_PIXEL_REF_H_