|
Lines 187-193
struct TextureMapperGLData {
a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp_sec1
|
| 187 |
void initializeStencil(); |
187 |
void initializeStencil(); |
| 188 |
|
188 |
|
| 189 |
TextureMapperGLData() |
189 |
TextureMapperGLData() |
| 190 |
: previousProgram(0) |
190 |
: paintingFlags(0) |
|
|
191 |
, previousProgram(0) |
| 192 |
, targetFrameBuffer(0) |
| 191 |
, didModifyStencil(false) |
193 |
, didModifyStencil(false) |
| 192 |
, previousScissorState(0) |
194 |
, previousScissorState(0) |
| 193 |
, previousDepthState(0) |
195 |
, previousDepthState(0) |
|
Lines 195-201
struct TextureMapperGLData {
a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp_sec2
|
| 195 |
{ } |
197 |
{ } |
| 196 |
|
198 |
|
| 197 |
TransformationMatrix projectionMatrix; |
199 |
TransformationMatrix projectionMatrix; |
|
|
200 |
TextureMapper::PaintingFlags paintingFlags; |
| 198 |
GLint previousProgram; |
201 |
GLint previousProgram; |
|
|
202 |
GLint targetFrameBuffer; |
| 199 |
bool didModifyStencil; |
203 |
bool didModifyStencil; |
| 200 |
GLint previousScissorState; |
204 |
GLint previousScissorState; |
| 201 |
GLint previousDepthState; |
205 |
GLint previousDepthState; |
|
Lines 226-232
TextureMapperGL::TextureMapperGL()
a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp_sec3
|
| 226 |
{ |
230 |
{ |
| 227 |
} |
231 |
} |
| 228 |
|
232 |
|
| 229 |
void TextureMapperGL::beginPainting() |
233 |
void TextureMapperGL::beginPainting(PaintingFlags flags) |
| 230 |
{ |
234 |
{ |
| 231 |
// Make sure that no GL error code stays from previous operations. |
235 |
// Make sure that no GL error code stays from previous operations. |
| 232 |
glGetError(); |
236 |
glGetError(); |
|
Lines 251-256
void TextureMapperGL::beginPainting()
a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp_sec4
|
| 251 |
GL_CMD(glGetIntegerv(GL_SCISSOR_BOX, data().previousScissor)); |
255 |
GL_CMD(glGetIntegerv(GL_SCISSOR_BOX, data().previousScissor)); |
| 252 |
data().sharedGLData().clipState.stencilIndex = 1; |
256 |
data().sharedGLData().clipState.stencilIndex = 1; |
| 253 |
data().sharedGLData().clipState.scissorBox = IntRect(0, 0, data().viewport[2], data().viewport[3]); |
257 |
data().sharedGLData().clipState.scissorBox = IntRect(0, 0, data().viewport[2], data().viewport[3]); |
|
|
258 |
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &data().targetFrameBuffer); |
| 259 |
data().paintingFlags = flags; |
| 254 |
bindSurface(0); |
260 |
bindSurface(0); |
| 255 |
} |
261 |
} |
| 256 |
|
262 |
|
|
Lines 491-505
void BitmapTextureGL::updateContents(Image* image, const IntRect& targetRect, co
a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp_sec5
|
| 491 |
|
497 |
|
| 492 |
} |
498 |
} |
| 493 |
|
499 |
|
| 494 |
static inline TransformationMatrix createProjectionMatrix(const IntSize& size, bool flip) |
500 |
static inline TransformationMatrix createProjectionMatrix(const IntSize& size, bool mirrored) |
| 495 |
{ |
501 |
{ |
| 496 |
const float near = 9999999; |
502 |
const float near = 9999999; |
| 497 |
const float far = -99999; |
503 |
const float far = -99999; |
| 498 |
|
504 |
|
| 499 |
return TransformationMatrix(2.0 / float(size.width()), 0, 0, 0, |
505 |
return TransformationMatrix(2.0 / float(size.width()), 0, 0, 0, |
| 500 |
0, (flip ? -2.0 : 2.0) / float(size.height()), 0, 0, |
506 |
0, (mirrored ? 2.0 : -2.0) / float(size.height()), 0, 0, |
| 501 |
0, 0, -2.f / (far - near), 0, |
507 |
0, 0, -2.f / (far - near), 0, |
| 502 |
-1, flip ? 1 : -1, -(far + near) / (far - near), 1); |
508 |
-1, mirrored ? -1 : 1, -(far + near) / (far - near), 1); |
| 503 |
} |
509 |
} |
| 504 |
|
510 |
|
| 505 |
void BitmapTextureGL::initializeStencil() |
511 |
void BitmapTextureGL::initializeStencil() |
|
Lines 534-540
void BitmapTextureGL::bind()
a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp_sec6
|
| 534 |
GL_CMD(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo)); |
540 |
GL_CMD(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo)); |
| 535 |
|
541 |
|
| 536 |
GL_CMD(glViewport(0, 0, size().width(), size().height())); |
542 |
GL_CMD(glViewport(0, 0, size().width(), size().height())); |
| 537 |
m_textureMapper->data().projectionMatrix = createProjectionMatrix(size(), false); |
543 |
const bool mirrored = true; |
|
|
544 |
m_textureMapper->data().projectionMatrix = createProjectionMatrix(size(), mirrored); |
| 538 |
m_textureMapper->beginClip(TransformationMatrix(), FloatRect(IntPoint::zero(), contentSize())); |
545 |
m_textureMapper->beginClip(TransformationMatrix(), FloatRect(IntPoint::zero(), contentSize())); |
| 539 |
} |
546 |
} |
| 540 |
|
547 |
|
|
Lines 570-579
void TextureMapperGL::bindSurface(BitmapTexture *surfacePointer)
a/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp_sec7
|
| 570 |
BitmapTextureGL* surface = static_cast<BitmapTextureGL*>(surfacePointer); |
577 |
BitmapTextureGL* surface = static_cast<BitmapTextureGL*>(surfacePointer); |
| 571 |
|
578 |
|
| 572 |
if (!surface) { |
579 |
if (!surface) { |
|
|
580 |
GL_CMD(glBindFramebuffer(GL_FRAMEBUFFER, data().targetFrameBuffer)); |
| 581 |
|
| 573 |
IntSize viewportSize(data().viewport[2], data().viewport[3]); |
582 |
IntSize viewportSize(data().viewport[2], data().viewport[3]); |
| 574 |
GL_CMD(glBindFramebuffer(GL_FRAMEBUFFER, 0)); |
583 |
const bool mirorred = data().paintingFlags & PaintingMirrored; |
| 575 |
data().projectionMatrix = createProjectionMatrix(viewportSize, true); |
584 |
data().projectionMatrix = createProjectionMatrix(viewportSize, mirorred); |
| 576 |
GL_CMD(glViewport(0, 0, viewportSize.width(), viewportSize.height())); |
585 |
GL_CMD(glViewport(0, 0, viewportSize.width(), viewportSize.height())); |
|
|
586 |
|
| 577 |
if (data().currentSurface) |
587 |
if (data().currentSurface) |
| 578 |
endClip(); |
588 |
endClip(); |
| 579 |
data().currentSurface.clear(); |
589 |
data().currentSurface.clear(); |