Make SampleApp build on Win32 (still requires glew, this needs to be fixed)

In fbo test funciton set min filter to nearest (for systems that don't support rendering to level of a texture that isn't mip map complete.)
Add a lot more sample slides to the win32 build
Fix texture red/blue color swap on windows.

git-svn-id: http://skia.googlecode.com/svn/trunk@677 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bsalomon@google.com 2011-01-05 16:34:41 +00:00
parent 5a8a131d8a
commit 2fbc7fa460
7 changed files with 400 additions and 238 deletions

View File

@ -190,9 +190,14 @@
#error "unknown GR_TEXT_SCALAR type"
#endif
// Pick a pixel config for 32bit bitmaps. Our default is GL_RGBA
#ifndef SK_GL_32BPP_COLOR_FORMAT
#define SK_GL_32BPP_COLOR_FORMAT GL_RGBA
// Pick a pixel config for 32bit bitmaps. Our default is GL_RGBA (expect on
// Windows where we match GDI's order).
#ifndef GR_GL_32BPP_COLOR_FORMAT
#if GR_WIN32_BUILD
#define GR_GL_32BPP_COLOR_FORMAT GL_BGRA
#else
#define GR_GL_32BPP_COLOR_FORMAT GL_RGBA
#endif
#endif
////////////////////////////////////////////////////////////////////////////////

View File

@ -31,10 +31,11 @@
//#define GR_FORCE_GLCHECKERR 1
/*
* The default 32bit pixel config for texture upload is GL_RGBA. If your
* bitmaps map to a different GL enum, specify that with this define.
* The default 32bit pixel config for texture upload is GL_RGBA on all
* platforms except on Windows where it is GL_BGRA. If your bitmaps map to a
* different GL enum, specify that with this define.
*/
//#define SK_GL_32BPP_COLOR_FORMAT GL_RGBA
//#define GR_GL_32BPP_COLOR_FORMAT GL_RGBA
/*
* To diagnose texture cache performance, define this to 1 if you want to see

View File

@ -17,6 +17,14 @@
#include "GrGpuGL.h"
#include "GrMemory.h"
#include <stdio.h>
#if GR_WIN32_BUILD
// need to get wglGetProcAddress
#undef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#endif
static const GLuint GR_MAX_GLUINT = ~0;
static const GLint GR_INVAL_GLINT = ~0;
@ -94,7 +102,9 @@ bool fbo_test(GrGLExts exts, int w, int h) {
GLuint testRTTex;
GR_GL(GenTextures(1, &testRTTex));
GR_GL(BindTexture(GL_TEXTURE_2D, testRTTex));
// some implementations require texture to be mip-map complete before
// FBO with level 0 bound as color attachment will be framebuffer complete.
GR_GL(TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
GR_GL(TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h,
0, GL_RGBA, GL_UNSIGNED_BYTE, NULL));
GR_GL(BindTexture(GL_TEXTURE_2D, 0));
@ -290,6 +300,18 @@ GrGpuGL::GrGpuGL() {
// Experiments to determine limitations that can't be queried. TODO: Make
// these a preprocess that generate some compile time constants.
// sanity check to make sure we can at least create an FBO from a POT texture
if (fNPOTTextureSupport < kFull_NPOTTextureType) {
bool npotFBOSuccess = fbo_test(fExts, 128, 128);
if (gPrintStartupSpew) {
if (!npotFBOSuccess) {
GrPrintf("FBO Sanity Test: FAILED\n");
} else {
GrPrintf("FBO Sanity Test: PASSED\n");
}
}
}
/* Experimentation has found that some GLs that support NPOT textures
do not support FBOs with a NPOT texture. They report "unsupported" FBO
status. I don't know how to explicitly query for this. Do an
@ -328,18 +350,6 @@ GrGpuGL::GrGpuGL() {
}
}
// sanity check to make sure we can at least create an FBO from a POT texture
if (fNPOTTextureSupport < kFull_NPOTTextureType) {
bool npotFBOSuccess = fbo_test(fExts, 128, 128);
if (gPrintStartupSpew) {
if (!npotFBOSuccess) {
GrPrintf("FBO Sanity Test: FAILED\n");
} else {
GrPrintf("FBO Sanity Test: PASSED\n");
}
}
}
/* The iPhone 4 has a restriction that for an FBO with texture color
attachment with height <= 8 then the width must be <= height. Here
we look for such a limitation.
@ -1628,7 +1638,7 @@ bool GrGpuGL::canBeTexture(GrTexture::PixelConfig config,
switch (config) {
case GrTexture::kRGBA_8888_PixelConfig:
case GrTexture::kRGBX_8888_PixelConfig: // todo: can we tell it our X?
*format = SK_GL_32BPP_COLOR_FORMAT;
*format = GR_GL_32BPP_COLOR_FORMAT;
*internalFormat = GL_RGBA;
*type = GL_UNSIGNED_BYTE;
break;
@ -1714,7 +1724,7 @@ typedef void (*glProc)(void);
void get_gl_proc(const char procName[], glProc *address) {
#if GR_WIN32_BUILD
*address = wglGetProcAddress(procName);
*address = (glProc)wglGetProcAddress(procName);
GrAssert(NULL != *address);
#elif GR_MAC_BUILD || GR_IOS_BUILD
GrAssert(!"Extensions don't need to be initialized!");

View File

@ -96,12 +96,15 @@ struct GrGpuGLShaders2::StageDesc {
kNoPerspective_OptFlagBit = 0x1,
kIdentityMatrix_OptFlagBit = 0x2,
};
int fOptFlags : 8;
bool fEnabled : 8;
unsigned fOptFlags : 8;
unsigned fEnabled : 8;
enum Modulation {
kColor_Modulation,
kAlpha_Modulation,
} fModulation : 8;
enum CoordMapping {
kIdentity_CoordMapping,
kRadialGradient_CoordMapping,
@ -113,13 +116,16 @@ struct GrGpuGLShaders2::StageDesc {
// must be tightly packed
struct GrGpuGLShaders2::ProgramDesc {
GrVertexLayout fVertexLayout;
GR_STATIC_ASSERT(2 == sizeof(GrVertexLayout)); // pack with next field
enum {
kNotPoints_OptFlagBit = 0x1,
kVertexColorAllOnes_OptFlagBit = 0x2,
};
// we're assuming optflags and layout pack into 32 bits
GR_STATIC_ASSERT(2 == sizeof(GrVertexLayout));
int fOptFlags : 16;
// VS 2010 seems to require short rather than just unsigned
// for this to pack
unsigned short fOptFlags : 16;
StageDesc fStages[NUM_STAGES];
@ -389,9 +395,9 @@ void GrGpuGLShaders2::ProgramUnitTest() {
x = (int)(random.nextF() * GR_ARRAY_COUNT(STAGE_OPTS));
pdesc.fStages[s].fOptFlags = STAGE_OPTS[x];
x = (int)(random.nextF() * GR_ARRAY_COUNT(STAGE_MODULATES));
pdesc.fStages[s].fModulation = STAGE_MODULATES[x];
pdesc.fStages[s].fModulation = (StageDesc::Modulation) STAGE_MODULATES[x];
x = (int)(random.nextF() * GR_ARRAY_COUNT(STAGE_COORD_MAPPINGS));
pdesc.fStages[s].fCoordMapping = STAGE_COORD_MAPPINGS[x];
pdesc.fStages[s].fCoordMapping = (StageDesc::CoordMapping) STAGE_COORD_MAPPINGS[x];
}
Program program;
GenProgram(pdesc, &program);
@ -948,8 +954,8 @@ void GrGpuGLShaders2::getProgramDesc(PrimitiveType primType, ProgramDesc* desc)
for (int i = 1; i < NUM_STAGES; ++i) {
desc->fStages[i].fEnabled = false;
desc->fStages[i].fOptFlags = 0;
desc->fStages[i].fCoordMapping = 0;
desc->fStages[i].fModulation = 0;
desc->fStages[i].fCoordMapping = (StageDesc::CoordMapping)0;
desc->fStages[i].fModulation = (StageDesc::Modulation)0;
}
if (primType != kPoints_PrimitiveType) {
@ -997,7 +1003,7 @@ void GrGpuGLShaders2::getProgramDesc(PrimitiveType primType, ProgramDesc* desc)
stage.fModulation = StageDesc::kColor_Modulation;
break;
case GrSamplerState::kSweep_SampleMode:
stage.fCoordMapping = StageDesc::StageDesc::kSweepGradient_CoordMapping;
stage.fCoordMapping = StageDesc::kSweepGradient_CoordMapping;
stage.fModulation = StageDesc::kColor_Modulation;
break;
default:
@ -1006,8 +1012,8 @@ void GrGpuGLShaders2::getProgramDesc(PrimitiveType primType, ProgramDesc* desc)
}
} else {
stage.fOptFlags = 0;
stage.fCoordMapping = 0;
stage.fModulation = 0;
stage.fCoordMapping = (StageDesc::CoordMapping)0;
stage.fModulation = (StageDesc::Modulation)0;
}
}

View File

@ -17,7 +17,6 @@
extern SkView* create_overview(int, const SkViewFactory[]);
#define SK_SUPPORT_GL
//#define SK_SUPPORT_D3D9
#define ANIMATING_EVENTTYPE "nextSample"
#define ANIMATING_DELAY 750
@ -28,8 +27,6 @@ extern SkView* create_overview(int, const SkViewFactory[]);
#ifdef SK_SUPPORT_GL
#include "GrGLConfig.h"
#elif defined(SK_SUPPORT_D3D9)
#include <d3d9.h>
#endif
SkViewRegister* SkViewRegister::gHead;
@ -44,10 +41,6 @@ SkViewRegister::SkViewRegister(SkViewFactory fact) : fFact(fact) {
gHead = this;
}
#if defined(SK_SUPPORT_GL) && defined(SK_SUPPORT_D3D9)
#error "choose either GL or D3D9"
#endif
#if defined(SK_SUPPORT_GL)
#define SK_USE_SHADERS
#endif
@ -62,11 +55,6 @@ static GrContext* get_global_grctx(SkOSWindow* oswin) {
#else
ctx = GrContext::Create(GrGpu::kOpenGL_Fixed_Engine, NULL);
#endif
#elif defined(SK_SUPPORT_D3D9)
if (oswin->d3d9Device()) {
ctx = GrContext::Create(GrGpu::kDirect3D9_Engine,
(IDirect3DDevice9*) oswin->d3d9Device());
}
#endif
}
return ctx;
@ -158,14 +146,14 @@ static SkView* curr_view(SkWindow* wind) {
class SampleWindow : public SkOSWindow {
SkTDArray<SkViewFactory> fSamples;
public:
SampleWindow(void* hwnd);
virtual ~SampleWindow();
SampleWindow(void* hwnd);
virtual ~SampleWindow();
virtual void draw(SkCanvas* canvas);
protected:
virtual void onDraw(SkCanvas* canvas);
virtual bool onHandleKey(SkKey key);
virtual bool onHandleKey(SkKey key);
virtual bool onHandleChar(SkUnichar);
virtual void onSizeChange();
@ -174,17 +162,17 @@ protected:
virtual void beforeChild(SkView* child, SkCanvas* canvas);
virtual void afterChild(SkView* child, SkCanvas* canvas);
virtual bool onEvent(const SkEvent& evt);
virtual bool onEvent(const SkEvent& evt);
virtual bool onQuery(SkEvent* evt);
#if 0
virtual bool handleChar(SkUnichar uni);
virtual bool handleEvent(const SkEvent& evt);
virtual bool handleKey(SkKey key);
virtual bool handleKeyUp(SkKey key);
virtual bool handleChar(SkUnichar uni);
virtual bool handleEvent(const SkEvent& evt);
virtual bool handleKey(SkKey key);
virtual bool handleKeyUp(SkKey key);
virtual bool onClick(Click* click);
virtual Click* onFindClickHandler(SkScalar x, SkScalar y);
virtual bool onClick(Click* click);
virtual Click* onFindClickHandler(SkScalar x, SkScalar y);
virtual bool onHandleKeyUp(SkKey key);
#endif
private:
@ -256,9 +244,9 @@ SampleWindow::SampleWindow(void* hwnd) : INHERITED(hwnd) {
fScrollTestX = fScrollTestY = 0;
// this->setConfig(SkBitmap::kRGB_565_Config);
this->setConfig(SkBitmap::kARGB_8888_Config);
this->setVisibleP(true);
// this->setConfig(SkBitmap::kRGB_565_Config);
this->setConfig(SkBitmap::kARGB_8888_Config);
this->setVisibleP(true);
this->setClipToBounds(false);
{
@ -376,8 +364,6 @@ SkCanvas* SampleWindow::beforeChildren(SkCanvas* canvas) {
if (kGPU_CanvasType != fCanvasType) {
#ifdef SK_SUPPORT_GL
detachGL();
#elif defined(SK_SUPPORT_D3D9)
detachD3D9();
#endif
}
@ -403,14 +389,11 @@ SkCanvas* SampleWindow::beforeChildren(SkCanvas* canvas) {
attachGL(NULL);
#endif
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
#elif defined(SK_SUPPORT_D3D9)
// now setup our canvas
attachD3D9();
#endif
fGpuCanvas = new SkGpuCanvas(get_global_grctx(this));
device = fGpuCanvas->createDevice(SkBitmap::kARGB_8888_Config,
bitmap.width(), bitmap.height(),
false, false);
device = fGpuCanvas->createDevice(SkBitmap::kARGB_8888_Config,
bitmap.width(), bitmap.height(),
false, false);
fGpuCanvas->setDevice(device)->unref();
canvas = fGpuCanvas;
@ -484,19 +467,11 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
delete fGpuCanvas;
fGpuCanvas = NULL;
presentGL();
#ifdef USE_OFFSCREEN
#ifdef USE_OFFSCREEN
reverseRedAndBlue(orig->getDevice()->accessBitmap(true));
#endif
#endif
break;
#elif defined(SK_SUPPORT_D3D9)
case kGPU_CanvasType: {
delete fGpuCanvas;
fGpuCanvas = NULL;
presentD3D9();
break;
}
#endif
}
// if ((fScrollTestX | fScrollTestY) != 0)
@ -950,7 +925,7 @@ static void test() {
SkOSWindow* create_sk_window(void* hwnd) {
// test();
return new SampleWindow(hwnd);
return new SampleWindow(hwnd);
}
void get_preferred_size(int* x, int* y, int* width, int* height) {
@ -965,11 +940,11 @@ void application_init() {
#ifdef SK_BUILD_FOR_MAC
setenv("ANDROID_ROOT", "/android/device/data", 0);
#endif
SkGraphics::Init();
SkEvent::Init();
SkGraphics::Init();
SkEvent::Init();
}
void application_term() {
SkEvent::Term();
SkGraphics::Term();
SkEvent::Term();
SkGraphics::Term();
}

View File

@ -45,58 +45,58 @@ SkOSWindow::~SkOSWindow() {
}
static SkKey winToskKey(WPARAM vk) {
static const struct {
WPARAM fVK;
SkKey fKey;
} gPair[] = {
{ VK_BACK, kBack_SkKey },
{ VK_CLEAR, kBack_SkKey },
{ VK_RETURN, kOK_SkKey },
{ VK_UP, kUp_SkKey },
{ VK_DOWN, kDown_SkKey },
{ VK_LEFT, kLeft_SkKey },
{ VK_RIGHT, kRight_SkKey }
};
for (size_t i = 0; i < SK_ARRAY_COUNT(gPair); i++) {
if (gPair[i].fVK == vk) {
return gPair[i].fKey;
}
}
return kNONE_SkKey;
static const struct {
WPARAM fVK;
SkKey fKey;
} gPair[] = {
{ VK_BACK, kBack_SkKey },
{ VK_CLEAR, kBack_SkKey },
{ VK_RETURN, kOK_SkKey },
{ VK_UP, kUp_SkKey },
{ VK_DOWN, kDown_SkKey },
{ VK_LEFT, kLeft_SkKey },
{ VK_RIGHT, kRight_SkKey }
};
for (size_t i = 0; i < SK_ARRAY_COUNT(gPair); i++) {
if (gPair[i].fVK == vk) {
return gPair[i].fKey;
}
}
return kNONE_SkKey;
}
bool SkOSWindow::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
switch (message) {
case WM_KEYDOWN: {
SkKey key = winToskKey(wParam);
if (kNONE_SkKey != key) {
this->handleKey(key);
return true;
}
} break;
case WM_KEYUP: {
SkKey key = winToskKey(wParam);
if (kNONE_SkKey != key) {
this->handleKeyUp(key);
return true;
}
} break;
case WM_UNICHAR:
this->handleChar(wParam);
switch (message) {
case WM_KEYDOWN: {
SkKey key = winToskKey(wParam);
if (kNONE_SkKey != key) {
this->handleKey(key);
return true;
}
} break;
case WM_KEYUP: {
SkKey key = winToskKey(wParam);
if (kNONE_SkKey != key) {
this->handleKeyUp(key);
return true;
}
} break;
case WM_UNICHAR:
this->handleChar(wParam);
return true;
case WM_CHAR: {
this->handleChar(SkUTF8_ToUnichar((char*)&wParam));
return true;
} break;
case WM_SIZE:
this->resize(lParam & 0xFFFF, lParam >> 16);
break;
case WM_PAINT: {
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
this->doPaint(hdc);
EndPaint(hWnd, &ps);
return true;
case WM_SIZE:
this->resize(lParam & 0xFFFF, lParam >> 16);
break;
case WM_PAINT: {
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
this->doPaint(hdc);
EndPaint(hWnd, &ps);
return true;
} break;
case WM_TIMER: {
@ -124,60 +124,60 @@ bool SkOSWindow::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
post_skwinevent();
}
return true;
}
return false;
}
return false;
}
void SkOSWindow::doPaint(void* ctx) {
this->update(NULL);
this->update(NULL);
if (!fGLAttached && !fD3D9Attached)
{
HDC hdc = (HDC)ctx;
HDC hdc = (HDC)ctx;
const SkBitmap& bitmap = this->getBitmap();
BITMAPINFO bmi;
memset(&bmi, 0, sizeof(bmi));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = bitmap.width();
bmi.bmiHeader.biHeight = -bitmap.height(); // top-down image
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = 0;
BITMAPINFO bmi;
memset(&bmi, 0, sizeof(bmi));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = bitmap.width();
bmi.bmiHeader.biHeight = -bitmap.height(); // top-down image
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = 0;
//
// Do the SetDIBitsToDevice.
//
//
// Do the SetDIBitsToDevice.
//
SkASSERT(bitmap.width() * bitmap.bytesPerPixel() == bitmap.rowBytes());
bitmap.lockPixels();
int iRet = SetDIBitsToDevice(hdc,
0, 0,
bitmap.width(), bitmap.height(),
0, 0,
0, bitmap.height(),
bitmap.getPixels(),
&bmi,
DIB_RGB_COLORS);
bitmap.unlockPixels();
bitmap.lockPixels();
int iRet = SetDIBitsToDevice(hdc,
0, 0,
bitmap.width(), bitmap.height(),
0, 0,
0, bitmap.height(),
bitmap.getPixels(),
&bmi,
DIB_RGB_COLORS);
bitmap.unlockPixels();
}
}
#if 0
void SkOSWindow::updateSize()
{
RECT r;
GetWindowRect((HWND)this->getHWND(), &r);
this->resize(r.right - r.left, r.bottom - r.top);
RECT r;
GetWindowRect((HWND)this->getHWND(), &r);
this->resize(r.right - r.left, r.bottom - r.top);
}
#endif
void SkOSWindow::onHandleInval(const SkIRect& r) {
RECT* rect = new RECT;
rect->left = r.fLeft;
rect->top = r.fTop;
rect->right = r.fRight;
rect->bottom = r.fBottom;
RECT* rect = new RECT;
rect->left = r.fLeft;
rect->top = r.fTop;
rect->right = r.fRight;
rect->bottom = r.fBottom;
SetTimer((HWND)fHWND, (UINT_PTR)rect, INVALIDATE_DELAY_MS, NULL);
}
@ -190,13 +190,13 @@ void SkOSWindow::onSetTitle(const char title[]){
}
enum {
SK_MacReturnKey = 36,
SK_MacDeleteKey = 51,
SK_MacEndKey = 119,
SK_MacLeftKey = 123,
SK_MacRightKey = 124,
SK_MacDownKey = 125,
SK_MacUpKey = 126,
SK_MacReturnKey = 36,
SK_MacDeleteKey = 51,
SK_MacEndKey = 119,
SK_MacLeftKey = 123,
SK_MacRightKey = 124,
SK_MacDownKey = 125,
SK_MacUpKey = 126,
SK_Mac0Key = 0x52,
SK_Mac1Key = 0x53,
@ -209,20 +209,20 @@ enum {
SK_Mac8Key = 0x5b,
SK_Mac9Key = 0x5c
};
static SkKey raw2key(uint32_t raw)
{
static const struct {
uint32_t fRaw;
SkKey fKey;
} gKeys[] = {
{ SK_MacUpKey, kUp_SkKey },
{ SK_MacDownKey, kDown_SkKey },
{ SK_MacLeftKey, kLeft_SkKey },
{ SK_MacRightKey, kRight_SkKey },
{ SK_MacReturnKey, kOK_SkKey },
{ SK_MacDeleteKey, kBack_SkKey },
{ SK_MacEndKey, kEnd_SkKey },
static const struct {
uint32_t fRaw;
SkKey fKey;
} gKeys[] = {
{ SK_MacUpKey, kUp_SkKey },
{ SK_MacDownKey, kDown_SkKey },
{ SK_MacLeftKey, kLeft_SkKey },
{ SK_MacRightKey, kRight_SkKey },
{ SK_MacReturnKey, kOK_SkKey },
{ SK_MacDeleteKey, kBack_SkKey },
{ SK_MacEndKey, kEnd_SkKey },
{ SK_Mac0Key, k0_SkKey },
{ SK_Mac1Key, k1_SkKey },
{ SK_Mac2Key, k2_SkKey },
@ -233,95 +233,95 @@ static SkKey raw2key(uint32_t raw)
{ SK_Mac7Key, k7_SkKey },
{ SK_Mac8Key, k8_SkKey },
{ SK_Mac9Key, k9_SkKey }
};
for (unsigned i = 0; i < SK_ARRAY_COUNT(gKeys); i++)
if (gKeys[i].fRaw == raw)
return gKeys[i].fKey;
return kNONE_SkKey;
};
for (unsigned i = 0; i < SK_ARRAY_COUNT(gKeys); i++)
if (gKeys[i].fRaw == raw)
return gKeys[i].fKey;
return kNONE_SkKey;
}
///////////////////////////////////////////////////////////////////////////////////////
void SkEvent::SignalNonEmptyQueue()
{
post_skwinevent();
//SkDebugf("signal nonempty\n");
post_skwinevent();
//SkDebugf("signal nonempty\n");
}
static UINT_PTR gTimer;
VOID CALLBACK sk_timer_proc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
SkEvent::ServiceQueueTimer();
//SkDebugf("timer task fired\n");
SkEvent::ServiceQueueTimer();
//SkDebugf("timer task fired\n");
}
void SkEvent::SignalQueueTimer(SkMSec delay)
{
if (gTimer)
{
if (gTimer)
{
KillTimer(NULL, gTimer);
gTimer = NULL;
gTimer = NULL;
}
if (delay)
{
if (delay)
{
gTimer = SetTimer(NULL, 0, delay, sk_timer_proc);
//SkDebugf("SetTimer of %d returned %d\n", delay, gTimer);
}
}
}
static HWND create_dummy()
{
HMODULE module = GetModuleHandle(NULL);
HWND dummy;
RECT windowRect;
windowRect.left = 0;
windowRect.right = 8;
windowRect.top = 0;
windowRect.bottom = 8;
HMODULE module = GetModuleHandle(NULL);
HWND dummy;
RECT windowRect;
windowRect.left = 0;
windowRect.right = 8;
windowRect.top = 0;
windowRect.bottom = 8;
WNDCLASS wc;
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = (WNDPROC) DefWindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = module;
wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.lpszClassName = L"DummyWindow";
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = (WNDPROC) DefWindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = module;
wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.lpszClassName = L"DummyWindow";
if(!RegisterClass(&wc))
{
return 0;
}
if(!RegisterClass(&wc))
{
return 0;
}
DWORD style, exStyle;
exStyle = WS_EX_CLIENTEDGE;
style = WS_SYSMENU;
DWORD style, exStyle;
exStyle = WS_EX_CLIENTEDGE;
style = WS_SYSMENU;
AdjustWindowRectEx(&windowRect, style, false, exStyle);
AdjustWindowRectEx(&windowRect, style, false, exStyle);
if(!(dummy = CreateWindowEx(exStyle,
L"DummyWindow",
L"Dummy Window",
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | style,
0, 0,
windowRect.right-windowRect.left,
windowRect.bottom-windowRect.top,
NULL, NULL,
module,
NULL)))
{
UnregisterClass(L"Dummy Window", module);
return NULL;
}
ShowWindow(dummy, SW_HIDE);
if(!(dummy = CreateWindowEx(exStyle,
L"DummyWindow",
L"Dummy Window",
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | style,
0, 0,
windowRect.right-windowRect.left,
windowRect.bottom-windowRect.top,
NULL, NULL,
module,
NULL)))
{
UnregisterClass(L"Dummy Window", module);
return NULL;
}
ShowWindow(dummy, SW_HIDE);
return dummy;
return dummy;
}
void kill_dummy(HWND dummy) {

View File

@ -37,9 +37,13 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>d:\libraries\glew\include;$(IncludePath)</IncludePath>
<LibraryPath>d:\libraries\glew\lib\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>d:\libraries\glew\include;$(IncludePath)</IncludePath>
<LibraryPath>d:\libraries\glew\lib\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@ -51,29 +55,32 @@
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include\core;..\..\include\xml;..\..\include\utils;..\..\include\config;..\..\include\views;..\..\src\core;..\..\include\images;..\..\include\effects</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\include\core;..\..\include\xml;..\..\include\utils;..\..\include\config;..\..\include\views;..\..\src\core;..\..\include\images;..\..\include\effects;..\..\include\gpu;..\..\gpu\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>glew32.lib;opengl32.lib;d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>MaxSpeed</Optimization>
<Optimization>Full</Optimization>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include\core;..\..\include\xml;..\..\include\utils;..\..\include\config;..\..\include\views;..\..\src\core;..\..\include\images;..\..\include\effects;..\..\include\gpu;..\..\gpu\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>glew32.lib;opengl32.lib;d3d9.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
@ -82,6 +89,73 @@
<None Include="small.ico" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\gpu\include\FlingState.h" />
<ClInclude Include="..\..\gpu\include\GrAllocator.h" />
<ClInclude Include="..\..\gpu\include\GrAllocPool.h" />
<ClInclude Include="..\..\gpu\include\GrAPI.h" />
<ClInclude Include="..\..\gpu\include\GrAtlas.h" />
<ClInclude Include="..\..\gpu\include\GrClip.h" />
<ClInclude Include="..\..\gpu\include\GrClipIterator.h" />
<ClInclude Include="..\..\gpu\include\GrColor.h" />
<ClInclude Include="..\..\gpu\include\GrConfig.h" />
<ClInclude Include="..\..\gpu\include\GrContext.h" />
<ClInclude Include="..\..\gpu\include\GrDrawTarget.h" />
<ClInclude Include="..\..\gpu\include\GrFontScaler.h" />
<ClInclude Include="..\..\gpu\include\GrGLConfig.h" />
<ClInclude Include="..\..\gpu\include\GrGLIndexBuffer.h" />
<ClInclude Include="..\..\gpu\include\GrGLTexture.h" />
<ClInclude Include="..\..\gpu\include\GrGLVertexBuffer.h" />
<ClInclude Include="..\..\gpu\include\GrGlyph.h" />
<ClInclude Include="..\..\gpu\include\GrGpu.h" />
<ClInclude Include="..\..\gpu\include\GrGpuVertex.h" />
<ClInclude Include="..\..\gpu\include\GrIndexBuffer.h" />
<ClInclude Include="..\..\gpu\include\GrInOrderDrawBuffer.h" />
<ClInclude Include="..\..\gpu\include\GrInstanceCounter.h" />
<ClInclude Include="..\..\gpu\include\GrIPoint.h" />
<ClInclude Include="..\..\gpu\include\GrKey.h" />
<ClInclude Include="..\..\gpu\include\GrMatrix.h" />
<ClInclude Include="..\..\gpu\include\GrMemory.h" />
<ClInclude Include="..\..\gpu\include\GrMesh.h" />
<ClInclude Include="..\..\gpu\include\GrNoncopyable.h" />
<ClInclude Include="..\..\gpu\include\GrPath.h" />
<ClInclude Include="..\..\gpu\include\GrPathIter.h" />
<ClInclude Include="..\..\gpu\include\GrPathSink.h" />
<ClInclude Include="..\..\gpu\include\GrPlotMgr.h" />
<ClInclude Include="..\..\gpu\include\GrPoint.h" />
<ClInclude Include="..\..\gpu\include\GrRandom.h" />
<ClInclude Include="..\..\gpu\include\GrRect.h" />
<ClInclude Include="..\..\gpu\include\GrRectanizer.h" />
<ClInclude Include="..\..\gpu\include\GrRefCnt.h" />
<ClInclude Include="..\..\gpu\include\GrSamplerState.h" />
<ClInclude Include="..\..\gpu\include\GrScalar.h" />
<ClInclude Include="..\..\gpu\include\GrStopwatch.h" />
<ClInclude Include="..\..\gpu\include\GrStringBuilder.h" />
<ClInclude Include="..\..\gpu\include\GrTArray.h" />
<ClInclude Include="..\..\gpu\include\GrTBSearch.h" />
<ClInclude Include="..\..\gpu\include\GrTDArray.h" />
<ClInclude Include="..\..\gpu\include\GrTextContext.h" />
<ClInclude Include="..\..\gpu\include\GrTextStrike.h" />
<ClInclude Include="..\..\gpu\include\GrTexture.h" />
<ClInclude Include="..\..\gpu\include\GrTextureCache.h" />
<ClInclude Include="..\..\gpu\include\GrTHashCache.h" />
<ClInclude Include="..\..\gpu\include\GrTLList.h" />
<ClInclude Include="..\..\gpu\include\GrTouchGesture.h" />
<ClInclude Include="..\..\gpu\include\GrTypes.h" />
<ClInclude Include="..\..\gpu\include\GrUserConfig.h" />
<ClInclude Include="..\..\gpu\include\GrVertexBuffer.h" />
<ClInclude Include="..\..\gpu\include\GrVertexBufferAllocPool.h" />
<ClInclude Include="..\..\gpu\include\SkUIView.h" />
<ClInclude Include="..\..\gpu\src\GrGpuGL.h" />
<ClInclude Include="..\..\gpu\src\GrGpuGLFixed.h" />
<ClInclude Include="..\..\gpu\src\GrGpuGLShaders.h" />
<ClInclude Include="..\..\gpu\src\GrGpuGLShaders2.h" />
<ClInclude Include="..\..\gpu\src\GrQuadIndexTable.h" />
<ClInclude Include="..\..\gpu\src\GrTextStrike_impl.h" />
<ClInclude Include="..\..\include\gpu\SkGpuCanvas.h" />
<ClInclude Include="..\..\include\gpu\SkGpuDevice.h" />
<ClInclude Include="..\..\include\gpu\SkGr.h" />
<ClInclude Include="..\..\include\gpu\SkGrTexturePixelRef.h" />
<ClInclude Include="..\..\samplecode\SampleCode.h" />
<ClInclude Include="..\..\src\core\SkAntiRun.h" />
<ClInclude Include="..\..\src\core\SkBitmapProcShader.h" />
<ClInclude Include="..\..\src\core\SkBitmapProcState.h" />
@ -132,10 +206,88 @@
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\experimental\SkSetPoly3To3.cpp" />
<ClCompile Include="..\..\gpu\src\GrAllocPool.cpp" />
<ClCompile Include="..\..\gpu\src\GrAtlas.cpp" />
<ClCompile Include="..\..\gpu\src\GrClip.cpp" />
<ClCompile Include="..\..\gpu\src\GrContext.cpp" />
<ClCompile Include="..\..\gpu\src\GrDrawTarget.cpp" />
<ClCompile Include="..\..\gpu\src\GrGLIndexBuffer.cpp" />
<ClCompile Include="..\..\gpu\src\GrGLTexture.cpp" />
<ClCompile Include="..\..\gpu\src\GrGLVertexBuffer.cpp" />
<ClCompile Include="..\..\gpu\src\GrGpu.cpp" />
<ClCompile Include="..\..\gpu\src\GrGpuFactory.cpp" />
<ClCompile Include="..\..\gpu\src\GrGpuGL.cpp" />
<ClCompile Include="..\..\gpu\src\GrGpuGLFixed.cpp" />
<ClCompile Include="..\..\gpu\src\GrGpuGLShaders.cpp" />
<ClCompile Include="..\..\gpu\src\GrGpuGLShaders2.cpp" />
<ClCompile Include="..\..\gpu\src\GrInOrderDrawBuffer.cpp" />
<ClCompile Include="..\..\gpu\src\GrMatrix.cpp" />
<ClCompile Include="..\..\gpu\src\GrMemory.cpp" />
<ClCompile Include="..\..\gpu\src\GrPath.cpp" />
<ClCompile Include="..\..\gpu\src\GrPrintf_printf.cpp" />
<ClCompile Include="..\..\gpu\src\GrRectanizer.cpp" />
<ClCompile Include="..\..\gpu\src\GrTextContext.cpp" />
<ClCompile Include="..\..\gpu\src\GrTextStrike.cpp" />
<ClCompile Include="..\..\gpu\src\GrTextureCache.cpp" />
<ClCompile Include="..\..\gpu\src\GrVertexBufferAllocPool.cpp" />
<ClCompile Include="..\..\gpu\src\gr_unittests.cpp" />
<ClCompile Include="..\..\samplecode\OverView.cpp" />
<ClCompile Include="..\..\samplecode\SampleAll.cpp" />
<ClCompile Include="..\..\samplecode\SampleApp.cpp" />
<ClCompile Include="..\..\samplecode\SampleArc.cpp" />
<ClCompile Include="..\..\samplecode\SampleAvoid.cpp" />
<ClCompile Include="..\..\samplecode\SampleBitmapRect.cpp" />
<ClCompile Include="..\..\samplecode\SampleBlur.cpp" />
<ClCompile Include="..\..\samplecode\SampleCamera.cpp" />
<ClCompile Include="..\..\samplecode\SampleCircle.cpp" />
<ClCompile Include="..\..\samplecode\SampleCull.cpp" />
<ClCompile Include="..\..\samplecode\SampleDecode.cpp" />
<ClCompile Include="..\..\samplecode\SampleDither.cpp" />
<ClCompile Include="..\..\samplecode\SampleDitherBitmap.cpp" />
<ClCompile Include="..\..\samplecode\SampleDrawLooper.cpp" />
<ClCompile Include="..\..\samplecode\SampleEffects.cpp" />
<ClCompile Include="..\..\samplecode\SampleEmboss.cpp" />
<ClCompile Include="..\..\samplecode\SampleExtractAlpha.cpp" />
<ClCompile Include="..\..\samplecode\SampleFillType.cpp" />
<ClCompile Include="..\..\samplecode\SampleFilter.cpp" />
<ClCompile Include="..\..\samplecode\SampleFilter2.cpp" />
<ClCompile Include="..\..\samplecode\SampleFontScalerTest.cpp" />
<ClCompile Include="..\..\samplecode\SampleFuzz.cpp" />
<ClCompile Include="..\..\samplecode\SampleGradients.cpp" />
<ClCompile Include="..\..\samplecode\SampleHairline.cpp" />
<ClCompile Include="..\..\samplecode\SampleLayerMask.cpp" />
<ClCompile Include="..\..\samplecode\SampleLayers.cpp" />
<ClCompile Include="..\..\samplecode\SampleLCD.cpp" />
<ClCompile Include="..\..\samplecode\SampleLineClipper.cpp" />
<ClCompile Include="..\..\samplecode\SampleLines.cpp" />
<ClCompile Include="..\..\samplecode\SampleMeasure.cpp" />
<ClCompile Include="..\..\samplecode\SampleMipMap.cpp" />
<ClCompile Include="..\..\samplecode\SampleNinePatch.cpp" />
<ClCompile Include="..\..\samplecode\SampleOverflow.cpp" />
<ClCompile Include="..\..\samplecode\SamplePatch.cpp" />
<ClCompile Include="..\..\samplecode\SamplePath.cpp" />
<ClCompile Include="..\..\samplecode\SamplePathClip.cpp" />
<ClCompile Include="..\..\samplecode\SamplePathEffects.cpp" />
<ClCompile Include="..\..\samplecode\SamplePoints.cpp" />
<ClCompile Include="..\..\samplecode\SamplePolyToPoly.cpp" />
<ClCompile Include="..\..\samplecode\SampleRegion.cpp" />
<ClCompile Include="..\..\samplecode\SampleRepeatTile.cpp" />
<ClCompile Include="..\..\samplecode\SampleShaders.cpp" />
<ClCompile Include="..\..\samplecode\SampleShapes.cpp" />
<ClCompile Include="..\..\samplecode\SampleSlides.cpp" />
<ClCompile Include="..\..\samplecode\SampleStrokePath.cpp" />
<ClCompile Include="..\..\samplecode\SampleStrokeText.cpp" />
<ClCompile Include="..\..\samplecode\SampleText.cpp" />
<ClCompile Include="..\..\samplecode\SampleTextAlpha.cpp" />
<ClCompile Include="..\..\samplecode\SampleTextBox.cpp" />
<ClCompile Include="..\..\samplecode\SampleTextEffects.cpp" />
<ClCompile Include="..\..\samplecode\SampleTextOnPath.cpp" />
<ClCompile Include="..\..\samplecode\SampleTiling.cpp" />
<ClCompile Include="..\..\samplecode\SampleTinyBitmap.cpp" />
<ClCompile Include="..\..\samplecode\SampleTypeface.cpp" />
<ClCompile Include="..\..\samplecode\SampleVertices.cpp" />
<ClCompile Include="..\..\samplecode\SampleXfermodes.cpp" />
<ClCompile Include="..\..\src\core\Sk64.cpp" />
<ClCompile Include="..\..\src\core\SkAlphaRuns.cpp" />
<ClCompile Include="..\..\src\core\SkBitmap.cpp" />
@ -183,6 +335,7 @@
<ClCompile Include="..\..\src\core\SkGlyphCache.cpp" />
<ClCompile Include="..\..\src\core\SkGraphics.cpp" />
<ClCompile Include="..\..\src\core\SkLineClipper.cpp" />
<ClCompile Include="..\..\src\core\SkMallocPixelRef.cpp" />
<ClCompile Include="..\..\src\core\SkMask.cpp" />
<ClCompile Include="..\..\src\core\SkMaskFilter.cpp" />
<ClCompile Include="..\..\src\core\SkMath.cpp" />
@ -208,6 +361,7 @@
<ClCompile Include="..\..\src\core\SkRefCnt.cpp" />
<ClCompile Include="..\..\src\core\SkRegion.cpp" />
<ClCompile Include="..\..\src\core\SkRegion_path.cpp" />
<ClCompile Include="..\..\src\core\SkScalar.cpp" />
<ClCompile Include="..\..\src\core\SkScalerContext.cpp" />
<ClCompile Include="..\..\src\core\SkScan.cpp" />
<ClCompile Include="..\..\src\core\SkScan_Antihair.cpp" />
@ -231,6 +385,7 @@
<ClCompile Include="..\..\src\effects\Sk1DPathEffect.cpp" />
<ClCompile Include="..\..\src\effects\Sk2DPathEffect.cpp" />
<ClCompile Include="..\..\src\effects\SkAvoidXfermode.cpp" />
<ClCompile Include="..\..\src\effects\SkBitmapCache.cpp" />
<ClCompile Include="..\..\src\effects\SkBlurDrawLooper.cpp" />
<ClCompile Include="..\..\src\effects\SkBlurMask.cpp" />
<ClCompile Include="..\..\src\effects\SkBlurMaskFilter.cpp" />
@ -252,6 +407,11 @@
<ClCompile Include="..\..\src\effects\SkRectShape.cpp" />
<ClCompile Include="..\..\src\effects\SkTableMaskFilter.cpp" />
<ClCompile Include="..\..\src\effects\SkTransparentShader.cpp" />
<ClCompile Include="..\..\src\gpu\SkGpuCanvas.cpp" />
<ClCompile Include="..\..\src\gpu\SkGpuDevice.cpp" />
<ClCompile Include="..\..\src\gpu\SkGr.cpp" />
<ClCompile Include="..\..\src\gpu\SkGrFontScaler.cpp" />
<ClCompile Include="..\..\src\gpu\SkGrTexturePixelRef.cpp" />
<ClCompile Include="..\..\src\images\SkImageDecoder.cpp" />
<ClCompile Include="..\..\src\images\SkImageDecoder_Factory.cpp" />
<ClCompile Include="..\..\src\images\SkImageEncoder.cpp" />
@ -267,15 +427,20 @@
<ClCompile Include="..\..\src\ports\SkThread_win.cpp" />
<ClCompile Include="..\..\src\ports\SkTime_win.cpp" />
<ClCompile Include="..\..\src\ports\SkXMLParser_empty.cpp" />
<ClCompile Include="..\..\src\utils\SkCamera.cpp" />
<ClCompile Include="..\..\src\utils\SkColorMatrix.cpp" />
<ClCompile Include="..\..\src\utils\SkCullPoints.cpp" />
<ClCompile Include="..\..\src\utils\SkDumpCanvas.cpp" />
<ClCompile Include="..\..\src\utils\SkParse.cpp" />
<ClCompile Include="..\..\src\utils\SkParsePath.cpp" />
<ClCompile Include="..\..\src\utils\SkUnitMappers.cpp" />
<ClCompile Include="..\..\src\utils\win\SkOSWindow_Win.cpp" />
<ClCompile Include="..\..\src\views\SkEvent.cpp" />
<ClCompile Include="..\..\src\views\SkEventSink.cpp" />
<ClCompile Include="..\..\src\views\SkMetaData.cpp" />
<ClCompile Include="..\..\src\views\SkOSMenu.cpp" />
<ClCompile Include="..\..\src\views\SkTagList.cpp" />
<ClCompile Include="..\..\src\views\SkTextBox.cpp" />
<ClCompile Include="..\..\src\views\SkView.cpp" />
<ClCompile Include="..\..\src\views\SkViewInflate.cpp" />
<ClCompile Include="..\..\src\views\SkViewPriv.cpp" />