| Index: src/image/SkImage_Gpu.cpp
|
| diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
|
| index 4417c7bc939bdb3c143fec0dd70f4c1c86a1b788..8cab9aec2c1b7150b900f46e3a0453b7a5a74ed8 100644
|
| --- a/src/image/SkImage_Gpu.cpp
|
| +++ b/src/image/SkImage_Gpu.cpp
|
| @@ -59,6 +59,7 @@ bool SkImage_Gpu::getROPixels(SkBitmap* dst) const {
|
| return true;
|
| }
|
|
|
| +<<<<<<< HEAD
|
| GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, SkImageUsageType usage) const {
|
| const bool is_pow2 = SkIsPow2(this->width()) && SkIsPow2(this->height());
|
| const bool npot_tex_supported = ctx->caps()->npotTextureTileSupport();
|
| @@ -71,6 +72,87 @@ GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, SkImageUsageType usage) con
|
| } else {
|
| return nullptr;
|
| }
|
| +||||||| merged common ancestors
|
| +static void make_raw_texture_stretched_key(uint32_t imageID, const SkGrStretch& stretch,
|
| + GrUniqueKey* stretchedKey) {
|
| + SkASSERT(SkGrStretch::kNone_Type != stretch.fType);
|
| +
|
| + uint32_t width = SkToU16(stretch.fWidth);
|
| + uint32_t height = SkToU16(stretch.fHeight);
|
| +
|
| + static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
|
| + GrUniqueKey::Builder builder(stretchedKey, kDomain, 3);
|
| + builder[0] = imageID;
|
| + builder[1] = stretch.fType;
|
| + builder[2] = width | (height << 16);
|
| + builder.finish();
|
| +}
|
| +
|
| +class Texture_GrTextureMaker : public GrTextureMaker {
|
| +public:
|
| + Texture_GrTextureMaker(const SkImage* image, GrTexture* unstretched)
|
| + : INHERITED(image->width(), image->height())
|
| + , fImage(image)
|
| + , fUnstretched(unstretched)
|
| + {}
|
| +
|
| +protected:
|
| + GrTexture* onRefUnstretchedTexture(GrContext* ctx) override {
|
| + return SkRef(fUnstretched);
|
| + }
|
| +
|
| + bool onMakeStretchedKey(const SkGrStretch& stretch, GrUniqueKey* stretchedKey) override {
|
| + make_raw_texture_stretched_key(fImage->uniqueID(), stretch, stretchedKey);
|
| + return stretchedKey->isValid();
|
| + }
|
| +
|
| + void onNotifyStretchCached(const GrUniqueKey& stretchedKey) override {
|
| + as_IB(fImage)->notifyAddedToCache();
|
| + }
|
| +
|
| + bool onGetROBitmap(SkBitmap* bitmap) override {
|
| + return as_IB(fImage)->getROPixels(bitmap);
|
| +=======
|
| +static void make_raw_texture_stretched_key(uint32_t imageID, const SkGrStretch& stretch,
|
| + GrUniqueKey* stretchedKey) {
|
| + SkASSERT(SkGrStretch::kNone_Type != stretch.fType);
|
| +
|
| + uint32_t width = SkToU16(stretch.fWidth);
|
| + uint32_t height = SkToU16(stretch.fHeight);
|
| +
|
| + static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
|
| + GrUniqueKey::Builder builder(stretchedKey, kDomain, 3);
|
| + builder[0] = imageID;
|
| + builder[1] = stretch.fType;
|
| + builder[2] = width | (height << 16);
|
| + builder.finish();
|
| +}
|
| +
|
| +class Texture_GrTextureMaker : public GrTextureMaker {
|
| +public:
|
| + Texture_GrTextureMaker(const SkImage* image, GrTexture* unstretched)
|
| + : INHERITED(image->width(), image->height())
|
| + , fImage(image)
|
| + , fUnstretched(unstretched)
|
| + {}
|
| +
|
| +protected:
|
| + GrTexture* onRefUnstretchedTexture(GrContext* ctx, const GrTextureParams*) override {
|
| + return SkRef(fUnstretched);
|
| + }
|
| +
|
| + bool onMakeStretchedKey(const SkGrStretch& stretch, GrUniqueKey* stretchedKey) override {
|
| + make_raw_texture_stretched_key(fImage->uniqueID(), stretch, stretchedKey);
|
| + return stretchedKey->isValid();
|
| + }
|
| +
|
| + void onNotifyStretchCached(const GrUniqueKey& stretchedKey) override {
|
| + as_IB(fImage)->notifyAddedToCache();
|
| + }
|
| +
|
| + bool onGetROBitmap(SkBitmap* bitmap) override {
|
| + return as_IB(fImage)->getROPixels(bitmap);
|
| +>>>>>>> Fixing the build.
|
| }
|
|
|
| fTexture->ref();
|
| @@ -288,7 +370,7 @@ GrTexture* GrDeepCopyTexture(GrTexture* src, bool budgeted) {
|
| if (!dst) {
|
| return nullptr;
|
| }
|
| -
|
| +
|
| const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight);
|
| const SkIPoint dstP = SkIPoint::Make(0, 0);
|
| ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp);
|
|
|