summaryrefslogtreecommitdiffstats
path: root/skia/ext/lazy_pixel_ref.h
blob: eb1b096a04114a5f3cc2f6baf0bc931036faa782 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SKIA_EXT_LAZY_PIXEL_REF_H_
#define SKIA_EXT_LAZY_PIXEL_REF_H_

#include "third_party/skia/include/core/SkPixelRef.h"
#include "third_party/skia/include/core/SkRect.h"

namespace skia {

// This class extends SkPixelRef to facilitate lazy image decoding on the impl
// thread.
class SK_API LazyPixelRef : public SkPixelRef {
 public:
  LazyPixelRef() : SkPixelRef(0) {}
  virtual ~LazyPixelRef() {}

  struct PrepareParams {
    // Clipping rect for this pixel ref.
    SkIRect clip_rect;
  };

  // Request the ImageDecodingStore to prepare image decoding for the
  // given clipping rect. Returns true is succeeded, or false otherwise.
  virtual bool PrepareToDecode(const PrepareParams& params) = 0;

  // Start decoding the image.
  virtual void Decode() = 0;
};

}  // namespace skia

#endif  // SKIA_EXT_LAZY_PIXEL_REF_H_