зеркало из https://github.com/mozilla/moz-skia.git
The GrContext and the GrFactoryContext are now kept around.
git-svn-id: http://skia.googlecode.com/svn/trunk@5172 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
4ea96c5e54
Коммит
0612564bb7
|
@ -115,6 +115,9 @@
|
|||
'tools.gyp:picture_renderer',
|
||||
'bench.gyp:bench_timer',
|
||||
],
|
||||
'export_dependent_settings': [
|
||||
'tools.gyp:picture_renderer',
|
||||
]
|
||||
},
|
||||
{
|
||||
'target_name': 'picture_renderer',
|
||||
|
@ -133,6 +136,11 @@
|
|||
'gpu.gyp:skgr',
|
||||
'tools.gyp:picture_utils',
|
||||
],
|
||||
'direct_dependent_settings': {
|
||||
'include_dirs': [
|
||||
'../include/gpu',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
'target_name': 'picture_utils',
|
||||
|
|
|
@ -9,10 +9,7 @@
|
|||
#include "picture_utils.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "gl/GrGLInterface.h"
|
||||
#include "GrContext.h"
|
||||
#include "SkGpuDevice.h"
|
||||
#include "GrContextFactory.h"
|
||||
#endif
|
||||
|
||||
namespace sk_tools {
|
||||
|
@ -44,15 +41,8 @@ void PictureRenderer::init(SkPicture* pict) {
|
|||
}
|
||||
#if SK_SUPPORT_GPU
|
||||
case kGPU_DeviceType: {
|
||||
// const GrGLInterface* interface = GrGLCreateNativeInterface();
|
||||
// GrContext* context = GrContext::Create(kOpenGL_Shaders_GrEngine,
|
||||
// (GrPlatform3DContext) interface);
|
||||
fGLContext = new SkNativeGLContext();
|
||||
SkASSERT(fGLContext->init(pict->width(), pict->height()));
|
||||
GrContextFactory factory;
|
||||
GrContext* context = factory.get(GrContextFactory::kNative_GLContextType);
|
||||
SkAutoTUnref<SkGpuDevice> device(SkNEW_ARGS(SkGpuDevice,
|
||||
(context, SkBitmap::kARGB_8888_Config,
|
||||
(fGrContext, SkBitmap::kARGB_8888_Config,
|
||||
pict->width(), pict->height())));
|
||||
fCanvas.reset(SkNEW_ARGS(SkCanvas, (device.get())));
|
||||
break;
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
#include "SkTDArray.h"
|
||||
#include "SkRefCnt.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "GrContextFactory.h"
|
||||
#include "GrContext.h"
|
||||
#endif
|
||||
|
||||
class SkBitmap;
|
||||
class SkCanvas;
|
||||
class SkGLContext;
|
||||
|
@ -38,7 +43,14 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
PictureRenderer() : fPicture(NULL), fDeviceType(kBitmap_DeviceType){}
|
||||
PictureRenderer()
|
||||
: fPicture(NULL)
|
||||
, fDeviceType(kBitmap_DeviceType)
|
||||
#if SK_SUPPORT_GPU
|
||||
, fGrContext(fGrContextFactory.get(GrContextFactory::kNative_GLContextType))
|
||||
#endif
|
||||
{}
|
||||
|
||||
protected:
|
||||
enum SkDeviceTypes {
|
||||
kBitmap_DeviceType,
|
||||
|
@ -50,7 +62,11 @@ protected:
|
|||
SkAutoTUnref<SkCanvas> fCanvas;
|
||||
SkPicture* fPicture;
|
||||
SkDeviceTypes fDeviceType;
|
||||
SkGLContext* fGLContext;
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
GrContextFactory fGrContextFactory;
|
||||
GrContext* fGrContext;
|
||||
#endif
|
||||
|
||||
private:
|
||||
typedef SkRefCnt INHERITED;
|
||||
|
|
Загрузка…
Ссылка в новой задаче