some catchup CL revisions
BUG=skia: Review URL: https://codereview.chromium.org/1295593002
This commit is contained in:
parent
7e6d9c0326
commit
8f4fe37b1c
@ -128,10 +128,8 @@ protected:
|
||||
|
||||
SkMatrix matrix;
|
||||
matrix.setTranslate(-100, -100);
|
||||
fCache.reset(new SkImageCacherator(SkImageGenerator::NewFromPicture(size,
|
||||
fPicture,
|
||||
&matrix,
|
||||
nullptr)));
|
||||
auto gen = SkImageGenerator::NewFromPicture(size, fPicture, &matrix, nullptr);
|
||||
fCache.reset(SkImageCacherator::NewFromGenerator(gen));
|
||||
}
|
||||
|
||||
void drawSet(SkCanvas* canvas) const {
|
||||
|
@ -144,9 +144,9 @@ public:
|
||||
* Regarding the SkImageUsageType parameter:
|
||||
*
|
||||
* If the context (the provided one or the generator's intrinsic one) determines that to
|
||||
* support the specified usage, it must return a different sized texture (from the generator's
|
||||
* native size) it may, so the caller must inspect the texture's width/height
|
||||
* (unless kUntiled_SkImageUsedType was specified).
|
||||
* support the specified usage, it must return a different sized texture it may,
|
||||
* so the caller must inspect the texture's width/height and compare them to the generator's
|
||||
* getInfo() width/height.
|
||||
*/
|
||||
GrTexture* generateTexture(GrContext*, SkImageUsageType);
|
||||
|
||||
|
@ -19,10 +19,17 @@
|
||||
#include "SkGrPriv.h"
|
||||
#endif
|
||||
|
||||
SkImageCacherator* SkImageCacherator::NewFromGenerator(SkImageGenerator* gen) {
|
||||
if (!gen) {
|
||||
return nullptr;
|
||||
}
|
||||
return SkNEW_ARGS(SkImageCacherator, (gen));
|
||||
}
|
||||
|
||||
SkImageCacherator::SkImageCacherator(SkImageGenerator* gen) : fGenerator(gen) {}
|
||||
|
||||
SkImageCacherator::~SkImageCacherator() {
|
||||
delete fGenerator;
|
||||
SkDELETE(fGenerator);
|
||||
}
|
||||
|
||||
static bool check_output_bitmap(const SkBitmap& bitmap, uint32_t expectedID) {
|
||||
|
@ -19,7 +19,8 @@ class SkBitmap;
|
||||
class SkImageCacherator {
|
||||
public:
|
||||
// Takes ownership of the generator
|
||||
SkImageCacherator(SkImageGenerator* gen);
|
||||
static SkImageCacherator* NewFromGenerator(SkImageGenerator*);
|
||||
|
||||
~SkImageCacherator();
|
||||
|
||||
const SkImageInfo& info() const { return fGenerator->getInfo(); }
|
||||
@ -28,8 +29,6 @@ public:
|
||||
/**
|
||||
* On success (true), bitmap will point to the pixels for this generator. If this returns
|
||||
* false, the bitmap will be reset to empty.
|
||||
*
|
||||
* The cached bitmap is valid until it goes out of scope.
|
||||
*/
|
||||
bool lockAsBitmap(SkBitmap*);
|
||||
|
||||
@ -37,11 +36,13 @@ public:
|
||||
* Returns a ref() on the texture produced by this generator. The caller must call unref()
|
||||
* when it is done. Will return NULL on failure.
|
||||
*
|
||||
* The cached texture is valid until it is unref'd.
|
||||
* The caller is responsible for calling texture->unref() when they are done.
|
||||
*/
|
||||
GrTexture* lockAsTexture(GrContext*, SkImageUsageType);
|
||||
|
||||
private:
|
||||
SkImageCacherator(SkImageGenerator* gen);
|
||||
|
||||
bool tryLockAsBitmap(SkBitmap*);
|
||||
GrTexture* tryLockAsTexture(GrContext*, SkImageUsageType);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user