diff options
author | qinmin@chromium.org <qinmin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-21 06:39:11 +0000 |
---|---|---|
committer | qinmin@chromium.org <qinmin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-21 06:39:11 +0000 |
commit | 37acafd62dce5d27347014751460bbfc5aac2c87 (patch) | |
tree | 5b489d6e07b125c36ee87ba02159783bb046b1ad /skia | |
parent | 4425b7bcee3faa7d67d9965a194fab277a742bc9 (diff) | |
download | chromium_src-37acafd62dce5d27347014751460bbfc5aac2c87.zip chromium_src-37acafd62dce5d27347014751460bbfc5aac2c87.tar.gz chromium_src-37acafd62dce5d27347014751460bbfc5aac2c87.tar.bz2 |
add SkLazyPixelRef for lazy image decoding on impl thread
This change adds the SkLazyPixelRef class to be used by the impl thread.
WebCore::LazyDecodingPixelRef can inherit from this class to allow the impl thread to communicate to the ImageDecodingStore.
The impl thread can call LockPixelsIfDecoded() to lock the pixels if the image is fully decoded. If the above call fails, the impl thread can call LockPixels() on the worker thread to start decoding the image (as this call can invoke ImageDecodingStore::lockPixels())
Review URL: https://chromiumcodereview.appspot.com/11413059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168995 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r-- | skia/ext/lazy_pixel_ref.h | 32 | ||||
-rw-r--r-- | skia/skia.gyp | 1 |
2 files changed, 33 insertions, 0 deletions
diff --git a/skia/ext/lazy_pixel_ref.h b/skia/ext/lazy_pixel_ref.h new file mode 100644 index 0000000..3cd834f --- /dev/null +++ b/skia/ext/lazy_pixel_ref.h @@ -0,0 +1,32 @@ +// 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: + 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_ diff --git a/skia/skia.gyp b/skia/skia.gyp index 98a9ee6..aa02390 100644 --- a/skia/skia.gyp +++ b/skia/skia.gyp @@ -167,6 +167,7 @@ 'ext/google_logging.cc', 'ext/image_operations.cc', 'ext/image_operations.h', + 'ext/lazy_pixel_ref.h', 'ext/SkThread_chrome.cc', 'ext/platform_canvas.cc', 'ext/platform_canvas.h', |