OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkWindow.h" | 8 #include "SkWindow.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkOSMenu.h" | 10 #include "SkOSMenu.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 #include <gx.h> | 110 #include <gx.h> |
111 extern GXDisplayProperties gDisplayProps; | 111 extern GXDisplayProperties gDisplayProps; |
112 #endif | 112 #endif |
113 | 113 |
114 #ifdef SK_SIMULATE_FAILED_MALLOC | 114 #ifdef SK_SIMULATE_FAILED_MALLOC |
115 extern bool gEnableControlledThrow; | 115 extern bool gEnableControlledThrow; |
116 #endif | 116 #endif |
117 | 117 |
118 bool SkWindow::update(SkIRect* updateArea) { | 118 bool SkWindow::update(SkIRect* updateArea) { |
119 if (!fDirtyRgn.isEmpty()) { | 119 if (!fDirtyRgn.isEmpty()) { |
| 120 #if defined(SK_BUILD_FOR_WINCE) && defined(USE_GX_SCREEN) |
120 SkBitmap bm = this->getBitmap(); | 121 SkBitmap bm = this->getBitmap(); |
121 | 122 |
122 #if defined(SK_BUILD_FOR_WINCE) && defined(USE_GX_SCREEN) | |
123 char* buffer = (char*)GXBeginDraw(); | 123 char* buffer = (char*)GXBeginDraw(); |
124 SkASSERT(buffer); | 124 SkASSERT(buffer); |
125 | 125 |
126 RECT rect; | 126 RECT rect; |
127 GetWindowRect((HWND)((SkOSWindow*)this)->getHWND(), &rect); | 127 GetWindowRect((HWND)((SkOSWindow*)this)->getHWND(), &rect); |
128 buffer += rect.top * gDisplayProps.cbyPitch + rect.left * gDisplayProps.
cbxPitch; | 128 buffer += rect.top * gDisplayProps.cbyPitch + rect.left * gDisplayProps.
cbxPitch; |
129 | 129 |
130 bm.setPixels(buffer); | 130 bm.setPixels(buffer); |
131 #endif | 131 #endif |
132 | 132 |
133 SkAutoTUnref<SkSurface> surface(this->createSurface()); | 133 SkAutoTUnref<SkSurface> surface(this->createSurface()); |
134 SkCanvas* canvas = surface->getCanvas(); | 134 SkCanvas* canvas = surface->getCanvas(); |
135 | 135 |
136 canvas->clipRegion(fDirtyRgn); | 136 canvas->clipRegion(fDirtyRgn); |
137 if (updateArea) | 137 if (updateArea) { |
138 *updateArea = fDirtyRgn.getBounds(); | 138 *updateArea = fDirtyRgn.getBounds(); |
| 139 } |
139 | 140 |
140 SkAutoCanvasRestore acr(canvas, true); | 141 SkAutoCanvasRestore acr(canvas, true); |
141 canvas->concat(fMatrix); | 142 canvas->concat(fMatrix); |
142 | 143 |
143 // empty this now, so we can correctly record any inval calls that | 144 // empty this now, so we can correctly record any inval calls that |
144 // might be made during the draw call. | 145 // might be made during the draw call. |
145 fDirtyRgn.setEmpty(); | 146 fDirtyRgn.setEmpty(); |
146 | 147 |
147 #ifdef SK_SIMULATE_FAILED_MALLOC | 148 #ifdef SK_SIMULATE_FAILED_MALLOC |
148 gEnableControlledThrow = true; | 149 gEnableControlledThrow = true; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; | 358 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; |
358 desc.fSampleCnt = attachmentInfo.fSampleCount; | 359 desc.fSampleCnt = attachmentInfo.fSampleCount; |
359 desc.fStencilBits = attachmentInfo.fStencilBits; | 360 desc.fStencilBits = attachmentInfo.fStencilBits; |
360 GrGLint buffer; | 361 GrGLint buffer; |
361 GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer); | 362 GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer); |
362 desc.fRenderTargetHandle = buffer; | 363 desc.fRenderTargetHandle = buffer; |
363 return grContext->textureProvider()->wrapBackendRenderTarget(desc); | 364 return grContext->textureProvider()->wrapBackendRenderTarget(desc); |
364 } | 365 } |
365 | 366 |
366 #endif | 367 #endif |
OLD | NEW |