dbe6074a06
Reason for revert: Turning bots red: Nanobench seems to be uniformly failing on Android (http://108.170.220.21:10117/builders/Perf-Android-Venue8-PowerVR-x86-Release/builds/99/steps/RunNanobench/logs/stdio) Ubuntu GTX660 32bit is failing in both Debug and Release on GM generation (it appears to be out of memory) (http://108.170.220.120:10117/builders/Test-Ubuntu12-ShuttleA-GTX660-x86-Debug/builds/2457/steps/GenerateGMs/logs/stdio) Original issue's description: > GrResourceCache2 manages scratch texture. > > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/3d398c876440deaab39bbf2a9b881c337e6dc8d4 R=bsalomon@google.com TBR=bsalomon@google.com NOTREECHECKS=true NOTRY=true BUG=skia: Author: robertphillips@google.com Review URL: https://codereview.chromium.org/611383003
67 lines
1.9 KiB
C++
67 lines
1.9 KiB
C++
/*
|
|
* Copyright 2010 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SkGrPixelRef_DEFINED
|
|
#define SkGrPixelRef_DEFINED
|
|
|
|
#include "SkBitmap.h"
|
|
#include "SkPixelRef.h"
|
|
#include "GrTexture.h"
|
|
#include "GrRenderTarget.h"
|
|
|
|
|
|
/**
|
|
* Common baseclass that implements onLockPixels() by calling onReadPixels().
|
|
* Since it has a copy, it always returns false for onLockPixelsAreWritable().
|
|
*/
|
|
class SK_API SkROLockPixelsPixelRef : public SkPixelRef {
|
|
public:
|
|
SK_DECLARE_INST_COUNT(SkROLockPixelsPixelRef)
|
|
SkROLockPixelsPixelRef(const SkImageInfo&);
|
|
virtual ~SkROLockPixelsPixelRef();
|
|
|
|
protected:
|
|
virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE;
|
|
virtual void onUnlockPixels() SK_OVERRIDE;
|
|
virtual bool onLockPixelsAreWritable() const SK_OVERRIDE; // return false;
|
|
|
|
private:
|
|
SkBitmap fBitmap;
|
|
typedef SkPixelRef INHERITED;
|
|
};
|
|
|
|
/**
|
|
* PixelRef that wraps a GrSurface
|
|
*/
|
|
class SK_API SkGrPixelRef : public SkROLockPixelsPixelRef {
|
|
public:
|
|
SK_DECLARE_INST_COUNT(SkGrPixelRef)
|
|
/**
|
|
* Constructs a pixel ref around a GrSurface. If the caller has locked the GrSurface in the
|
|
* cache and would like the pixel ref to unlock it in its destructor then transferCacheLock
|
|
* should be set to true.
|
|
*/
|
|
SkGrPixelRef(const SkImageInfo&, GrSurface*, bool transferCacheLock = false);
|
|
virtual ~SkGrPixelRef();
|
|
|
|
// override from SkPixelRef
|
|
virtual GrTexture* getTexture() SK_OVERRIDE;
|
|
|
|
protected:
|
|
// overrides from SkPixelRef
|
|
virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subset) SK_OVERRIDE;
|
|
virtual SkPixelRef* deepCopy(SkColorType, const SkIRect* subset) SK_OVERRIDE;
|
|
|
|
private:
|
|
GrSurface* fSurface;
|
|
bool fUnlock; // if true the pixel ref owns a texture cache lock on fSurface
|
|
|
|
typedef SkROLockPixelsPixelRef INHERITED;
|
|
};
|
|
|
|
#endif
|