Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: cc/CCRendererGL.cpp

Issue 10984053: cc: Use ui/gfx geometry types for the CCRenderPass and CCDrawQuad classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 #include "config.h" 6 #include "config.h"
7 7
8 #if USE(ACCELERATED_COMPOSITING) 8 #if USE(ACCELERATED_COMPOSITING)
9 #include "CCRendererGL.h" 9 #include "CCRendererGL.h"
10 10
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 if (frame.currentRenderPass->hasTransparentBackground()) 201 if (frame.currentRenderPass->hasTransparentBackground())
202 #endif 202 #endif
203 m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT); 203 m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
204 } 204 }
205 205
206 void CCRendererGL::beginDrawingFrame(DrawingFrame& frame) 206 void CCRendererGL::beginDrawingFrame(DrawingFrame& frame)
207 { 207 {
208 // FIXME: Remove this once framebuffer is automatically recreated on first u se 208 // FIXME: Remove this once framebuffer is automatically recreated on first u se
209 ensureFramebuffer(); 209 ensureFramebuffer();
210 210
211 if (viewportSize().isEmpty()) 211 if (viewportSize().IsEmpty())
212 return; 212 return;
213 213
214 TRACE_EVENT0("cc", "CCRendererGL::drawLayers"); 214 TRACE_EVENT0("cc", "CCRendererGL::drawLayers");
215 if (m_isViewportChanged) { 215 if (m_isViewportChanged) {
216 // Only reshape when we know we are going to draw. Otherwise, the reshap e 216 // Only reshape when we know we are going to draw. Otherwise, the reshap e
217 // can leave the window at the wrong size if we never draw and the prope r 217 // can leave the window at the wrong size if we never draw and the prope r
218 // viewport size is never set. 218 // viewport size is never set.
219 m_isViewportChanged = false; 219 m_isViewportChanged = false;
220 m_context->reshape(viewportWidth(), viewportHeight()); 220 m_context->reshape(viewportWidth(), viewportHeight());
221 } 221 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 break; 277 break;
278 } 278 }
279 } 279 }
280 280
281 void CCRendererGL::drawCheckerboardQuad(const DrawingFrame& frame, const CCCheck erboardDrawQuad* quad) 281 void CCRendererGL::drawCheckerboardQuad(const DrawingFrame& frame, const CCCheck erboardDrawQuad* quad)
282 { 282 {
283 const TileCheckerboardProgram* program = tileCheckerboardProgram(); 283 const TileCheckerboardProgram* program = tileCheckerboardProgram();
284 ASSERT(program && program->initialized()); 284 ASSERT(program && program->initialized());
285 GLC(context(), context()->useProgram(program->program())); 285 GLC(context(), context()->useProgram(program->program()));
286 286
287 IntRect tileRect = quad->quadRect(); 287 ccmath::IntRect tileRect = quad->quadRect();
288 float texOffsetX = tileRect.x(); 288 float texOffsetX = tileRect.x();
289 float texOffsetY = tileRect.y(); 289 float texOffsetY = tileRect.y();
290 float texScaleX = tileRect.width(); 290 float texScaleX = tileRect.width();
291 float texScaleY = tileRect.height(); 291 float texScaleY = tileRect.height();
292 GLC(context(), context()->uniform4f(program->fragmentShader().texTransformLo cation(), texOffsetX, texOffsetY, texScaleX, texScaleY)); 292 GLC(context(), context()->uniform4f(program->fragmentShader().texTransformLo cation(), texOffsetX, texOffsetY, texScaleX, texScaleY));
293 293
294 const int checkerboardWidth = 16; 294 const int checkerboardWidth = 16;
295 float frequency = 1.0 / checkerboardWidth; 295 float frequency = 1.0 / checkerboardWidth;
296 296
297 GLC(context(), context()->uniform1f(program->fragmentShader().frequencyLocat ion(), frequency)); 297 GLC(context(), context()->uniform1f(program->fragmentShader().frequencyLocat ion(), frequency));
298 298
299 setShaderOpacity(quad->opacity(), program->fragmentShader().alphaLocation()) ; 299 setShaderOpacity(quad->opacity(), program->fragmentShader().alphaLocation()) ;
300 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->ve rtexShader().matrixLocation()); 300 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->ve rtexShader().matrixLocation());
301 } 301 }
302 302
303 void CCRendererGL::drawDebugBorderQuad(const DrawingFrame& frame, const CCDebugB orderDrawQuad* quad) 303 void CCRendererGL::drawDebugBorderQuad(const DrawingFrame& frame, const CCDebugB orderDrawQuad* quad)
304 { 304 {
305 static float glMatrix[16]; 305 static float glMatrix[16];
306 const SolidColorProgram* program = solidColorProgram(); 306 const SolidColorProgram* program = solidColorProgram();
307 ASSERT(program && program->initialized()); 307 ASSERT(program && program->initialized());
308 GLC(context(), context()->useProgram(program->program())); 308 GLC(context(), context()->useProgram(program->program()));
309 309
310 // Use the full quadRect for debug quads to not move the edges based on part ial swaps. 310 // Use the full quadRect for debug quads to not move the edges based on part ial swaps.
311 const IntRect& layerRect = quad->quadRect(); 311 const ccmath::IntRect& layerRect = quad->quadRect();
312 WebTransformationMatrix renderMatrix = quad->quadTransform(); 312 WebTransformationMatrix renderMatrix = quad->quadTransform();
313 renderMatrix.translate(0.5 * layerRect.width() + layerRect.x(), 0.5 * layerR ect.height() + layerRect.y()); 313 renderMatrix.translate(0.5 * layerRect.width() + layerRect.x(), 0.5 * layerR ect.height() + layerRect.y());
314 renderMatrix.scaleNonUniform(layerRect.width(), layerRect.height()); 314 renderMatrix.scaleNonUniform(layerRect.width(), layerRect.height());
315 CCRendererGL::toGLMatrix(&glMatrix[0], frame.projectionMatrix * renderMatrix ); 315 CCRendererGL::toGLMatrix(&glMatrix[0], frame.projectionMatrix * renderMatrix );
316 GLC(context(), context()->uniformMatrix4fv(program->vertexShader().matrixLoc ation(), 1, false, &glMatrix[0])); 316 GLC(context(), context()->uniformMatrix4fv(program->vertexShader().matrixLoc ation(), 1, false, &glMatrix[0]));
317 317
318 SkColor color = quad->color(); 318 SkColor color = quad->color();
319 float alpha = SkColorGetA(color) / 255.0; 319 float alpha = SkColorGetA(color) / 255.0;
320 320
321 GLC(context(), context()->uniform4f(program->fragmentShader().colorLocation( ), (SkColorGetR(color) / 255.0) * alpha, (SkColorGetG(color) / 255.0) * alpha, ( SkColorGetB(color) / 255.0) * alpha, alpha)); 321 GLC(context(), context()->uniform4f(program->fragmentShader().colorLocation( ), (SkColorGetR(color) / 255.0) * alpha, (SkColorGetG(color) / 255.0) * alpha, ( SkColorGetB(color) / 255.0) * alpha, alpha));
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 if (filters.isEmpty()) 365 if (filters.isEmpty())
366 return nullptr; 366 return nullptr;
367 367
368 // FIXME: We only allow background filters on an opaque render surface becau se other surfaces may contain 368 // FIXME: We only allow background filters on an opaque render surface becau se other surfaces may contain
369 // translucent pixels, and the contents behind those translucent pixels woul dn't have the filter applied. 369 // translucent pixels, and the contents behind those translucent pixels woul dn't have the filter applied.
370 if (frame.currentRenderPass->hasTransparentBackground()) 370 if (frame.currentRenderPass->hasTransparentBackground())
371 return nullptr; 371 return nullptr;
372 ASSERT(!frame.currentTexture); 372 ASSERT(!frame.currentTexture);
373 373
374 // FIXME: Do a single readback for both the surface and replica and cache th e filtered results (once filter textures are not reused). 374 // FIXME: Do a single readback for both the surface and replica and cache th e filtered results (once filter textures are not reused).
375 IntRect deviceRect = enclosingIntRect(CCMathUtil::mapClippedRect(contentsDev iceTransform, sharedGeometryQuad().boundingBox())); 375 ccmath::IntRect deviceRect = ccmath::FloatRect(CCMathUtil::mapClippedRect(co ntentsDeviceTransform, sharedGeometryQuad().boundingBox())).EnclosingIntRect();
376 376
377 int top, right, bottom, left; 377 int top, right, bottom, left;
378 filters.getOutsets(top, right, bottom, left); 378 filters.getOutsets(top, right, bottom, left);
379 deviceRect.move(-left, -top); 379 deviceRect.InflateX(-left);
380 deviceRect.expand(left + right, top + bottom); 380 deviceRect.InflateY(-top);
381 deviceRect.InflateWidth(left + right);
382 deviceRect.InflateHeight(top + bottom);
381 383
382 deviceRect.intersect(frame.currentRenderPass->outputRect()); 384 deviceRect.Intersect(frame.currentRenderPass->outputRect());
383 385
384 OwnPtr<CCScopedTexture> deviceBackgroundTexture = CCScopedTexture::create(m_ resourceProvider); 386 OwnPtr<CCScopedTexture> deviceBackgroundTexture = CCScopedTexture::create(m_ resourceProvider);
385 if (!getFramebufferTexture(deviceBackgroundTexture.get(), deviceRect)) 387 if (!getFramebufferTexture(deviceBackgroundTexture.get(), cc::IntRect(device Rect)))
386 return nullptr; 388 return nullptr;
387 389
388 SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgr oundTexture.get()); 390 SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgr oundTexture.get());
389 if (!filteredDeviceBackground.getTexture()) 391 if (!filteredDeviceBackground.getTexture())
390 return nullptr; 392 return nullptr;
391 393
392 GrTexture* texture = reinterpret_cast<GrTexture*>(filteredDeviceBackground.g etTexture()); 394 GrTexture* texture = reinterpret_cast<GrTexture*>(filteredDeviceBackground.g etTexture());
393 int filteredDeviceBackgroundTextureId = texture->getTextureHandle(); 395 int filteredDeviceBackgroundTextureId = texture->getTextureHandle();
394 396
395 OwnPtr<CCScopedTexture> backgroundTexture = CCScopedTexture::create(m_resour ceProvider); 397 OwnPtr<CCScopedTexture> backgroundTexture = CCScopedTexture::create(m_resour ceProvider);
396 if (!backgroundTexture->allocate(CCRenderer::ImplPool, quad->quadRect().size (), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageFramebuffer)) 398 if (!backgroundTexture->allocate(CCRenderer::ImplPool, cc::IntSize(quad->qua dRect().size()), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageFrameb uffer))
397 return nullptr; 399 return nullptr;
398 400
399 const CCRenderPass* targetRenderPass = frame.currentRenderPass; 401 const CCRenderPass* targetRenderPass = frame.currentRenderPass;
400 bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get( ), quad->quadRect()); 402 bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get( ), quad->quadRect());
401 403
402 if (usingBackgroundTexture) { 404 if (usingBackgroundTexture) {
403 // Copy the readback pixels from device to the background texture for th e surface. 405 // Copy the readback pixels from device to the background texture for th e surface.
404 WebTransformationMatrix deviceToFramebufferTransform; 406 WebTransformationMatrix deviceToFramebufferTransform;
405 deviceToFramebufferTransform.translate(quad->quadRect().width() / 2.0, q uad->quadRect().height() / 2.0); 407 deviceToFramebufferTransform.translate(quad->quadRect().width() / 2.0, q uad->quadRect().height() / 2.0);
406 deviceToFramebufferTransform.scale3d(quad->quadRect().width(), quad->qua dRect().height(), 1); 408 deviceToFramebufferTransform.scale3d(quad->quadRect().width(), quad->qua dRect().height(), 1);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 uniforms.pointLocation = program->vertexShader().pointLocation(); 593 uniforms.pointLocation = program->vertexShader().pointLocation();
592 594
593 uniforms.samplerLocation = program->fragmentShader().samplerLocation(); 595 uniforms.samplerLocation = program->fragmentShader().samplerLocation();
594 uniforms.alphaLocation = program->fragmentShader().alphaLocation(); 596 uniforms.alphaLocation = program->fragmentShader().alphaLocation();
595 uniforms.fragmentTexTransformLocation = program->fragmentShader().fragmentTe xTransformLocation(); 597 uniforms.fragmentTexTransformLocation = program->fragmentShader().fragmentTe xTransformLocation();
596 uniforms.edgeLocation = program->fragmentShader().edgeLocation(); 598 uniforms.edgeLocation = program->fragmentShader().edgeLocation();
597 } 599 }
598 600
599 void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* quad) 601 void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* quad)
600 { 602 {
601 IntRect tileRect = quad->quadVisibleRect(); 603 ccmath::IntRect tileRect = quad->quadVisibleRect();
602 604
603 FloatRect clampRect(tileRect); 605 ccmath::FloatRect clampRect(tileRect);
604 // Clamp texture coordinates to avoid sampling outside the layer 606 // Clamp texture coordinates to avoid sampling outside the layer
605 // by deflating the tile region half a texel or half a texel 607 // by deflating the tile region half a texel or half a texel
606 // minus epsilon for one pixel layers. The resulting clamp region 608 // minus epsilon for one pixel layers. The resulting clamp region
607 // is mapped to the unit square by the vertex shader and mapped 609 // is mapped to the unit square by the vertex shader and mapped
608 // back to normalized texture coordinates by the fragment shader 610 // back to normalized texture coordinates by the fragment shader
609 // after being clamped to 0-1 range. 611 // after being clamped to 0-1 range.
610 const float epsilon = 1 / 1024.0f; 612 const float epsilon = 1 / 1024.0f;
611 float clampX = min(0.5, clampRect.width() / 2.0 - epsilon); 613 float clampX = min(0.5, clampRect.width() / 2.0 - epsilon);
612 float clampY = min(0.5, clampRect.height() / 2.0 - epsilon); 614 float clampY = min(0.5, clampRect.height() / 2.0 - epsilon);
613 clampRect.inflateX(-clampX); 615 clampRect.InflateX(-clampX);
614 clampRect.inflateY(-clampY); 616 clampRect.InflateY(-clampY);
615 FloatSize clampOffset = clampRect.minXMinYCorner() - FloatRect(tileRect).min XMinYCorner(); 617 ccmath::FloatVector2d clampOffset = clampRect.location() - tileRect.location ();
616 618
617 FloatPoint textureOffset = quad->textureOffset() + clampOffset + 619 ccmath::FloatPoint textureOffset = quad->textureOffset() + clampOffset +
618 IntPoint(tileRect.location() - quad->quadRect().l ocation()); 620 (tileRect.location() - quad->quadRect().l ocation());
619 621
620 // Map clamping rectangle to unit square. 622 // Map clamping rectangle to unit square.
621 float vertexTexTranslateX = -clampRect.x() / clampRect.width(); 623 float vertexTexTranslateX = -clampRect.x() / clampRect.width();
622 float vertexTexTranslateY = -clampRect.y() / clampRect.height(); 624 float vertexTexTranslateY = -clampRect.y() / clampRect.height();
623 float vertexTexScaleX = tileRect.width() / clampRect.width(); 625 float vertexTexScaleX = tileRect.width() / clampRect.width();
624 float vertexTexScaleY = tileRect.height() / clampRect.height(); 626 float vertexTexScaleY = tileRect.height() / clampRect.height();
625 627
626 // Map to normalized texture coordinates. 628 // Map to normalized texture coordinates.
627 const IntSize& textureSize = quad->textureSize(); 629 const ccmath::IntSize& textureSize = quad->textureSize();
628 float fragmentTexTranslateX = textureOffset.x() / textureSize.width(); 630 float fragmentTexTranslateX = textureOffset.x() / textureSize.width();
629 float fragmentTexTranslateY = textureOffset.y() / textureSize.height(); 631 float fragmentTexTranslateY = textureOffset.y() / textureSize.height();
630 float fragmentTexScaleX = clampRect.width() / textureSize.width(); 632 float fragmentTexScaleX = clampRect.width() / textureSize.width();
631 float fragmentTexScaleY = clampRect.height() / textureSize.height(); 633 float fragmentTexScaleY = clampRect.height() / textureSize.height();
632 634
633 635
634 FloatQuad localQuad; 636 FloatQuad localQuad;
635 WebTransformationMatrix deviceTransform = WebTransformationMatrix(frame.wind owMatrix * frame.projectionMatrix * quad->quadTransform()).to2dTransform(); 637 WebTransformationMatrix deviceTransform = WebTransformationMatrix(frame.wind owMatrix * frame.projectionMatrix * quad->quadTransform()).to2dTransform();
636 if (!deviceTransform.isInvertible()) 638 if (!deviceTransform.isInvertible())
637 return; 639 return;
638 640
639 bool clipped = false; 641 bool clipped = false;
640 FloatQuad deviceLayerQuad = CCMathUtil::mapQuad(deviceTransform, FloatQuad(q uad->visibleContentRect()), clipped); 642 FloatQuad deviceLayerQuad = CCMathUtil::mapQuad(deviceTransform, FloatQuad(c c::IntRect(quad->visibleContentRect())), clipped);
641 ASSERT(!clipped); 643 ASSERT(!clipped);
642 644
643 TileProgramUniforms uniforms; 645 TileProgramUniforms uniforms;
644 // For now, we simply skip anti-aliasing with the quad is clipped. This only happens 646 // For now, we simply skip anti-aliasing with the quad is clipped. This only happens
645 // on perspective transformed layers that go partially behind the camera. 647 // on perspective transformed layers that go partially behind the camera.
646 if (quad->isAntialiased() && !clipped) { 648 if (quad->isAntialiased() && !clipped) {
647 if (quad->swizzleContents()) 649 if (quad->swizzleContents())
648 tileUniformLocation(tileProgramSwizzleAA(), uniforms); 650 tileUniformLocation(tileProgramSwizzleAA(), uniforms);
649 else 651 else
650 tileUniformLocation(tileProgramAA(), uniforms); 652 tileUniformLocation(tileProgramAA(), uniforms);
(...skipping 28 matching lines...) Expand all
679 deviceLayerEdges.inflateAntiAliasingDistance(); 681 deviceLayerEdges.inflateAntiAliasingDistance();
680 682
681 float edge[24]; 683 float edge[24];
682 deviceLayerEdges.toFloatArray(edge); 684 deviceLayerEdges.toFloatArray(edge);
683 deviceLayerBounds.toFloatArray(&edge[12]); 685 deviceLayerBounds.toFloatArray(&edge[12]);
684 GLC(context(), context()->uniform3fv(uniforms.edgeLocation, 8, edge)); 686 GLC(context(), context()->uniform3fv(uniforms.edgeLocation, 8, edge));
685 687
686 GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation, vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY)); 688 GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation, vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY));
687 GLC(context(), context()->uniform4f(uniforms.fragmentTexTransformLocatio n, fragmentTexTranslateX, fragmentTexTranslateY, fragmentTexScaleX, fragmentTexS caleY)); 689 GLC(context(), context()->uniform4f(uniforms.fragmentTexTransformLocatio n, fragmentTexTranslateX, fragmentTexTranslateY, fragmentTexScaleX, fragmentTexS caleY));
688 690
689 FloatPoint bottomRight(tileRect.maxX(), tileRect.maxY()); 691 FloatPoint bottomRight(tileRect.max_x(), tileRect.max_y());
690 FloatPoint bottomLeft(tileRect.x(), tileRect.maxY()); 692 FloatPoint bottomLeft(tileRect.x(), tileRect.max_y());
691 FloatPoint topLeft(tileRect.x(), tileRect.y()); 693 FloatPoint topLeft(tileRect.x(), tileRect.y());
692 FloatPoint topRight(tileRect.maxX(), tileRect.y()); 694 FloatPoint topRight(tileRect.max_x(), tileRect.y());
693 695
694 // Map points to device space. 696 // Map points to device space.
695 bottomRight = CCMathUtil::mapPoint(deviceTransform, bottomRight, clipped ); 697 bottomRight = CCMathUtil::mapPoint(deviceTransform, bottomRight, clipped );
696 ASSERT(!clipped); 698 ASSERT(!clipped);
697 bottomLeft = CCMathUtil::mapPoint(deviceTransform, bottomLeft, clipped); 699 bottomLeft = CCMathUtil::mapPoint(deviceTransform, bottomLeft, clipped);
698 ASSERT(!clipped); 700 ASSERT(!clipped);
699 topLeft = CCMathUtil::mapPoint(deviceTransform, topLeft, clipped); 701 topLeft = CCMathUtil::mapPoint(deviceTransform, topLeft, clipped);
700 ASSERT(!clipped); 702 ASSERT(!clipped);
701 topRight = CCMathUtil::mapPoint(deviceTransform, topRight, clipped); 703 topRight = CCMathUtil::mapPoint(deviceTransform, topRight, clipped);
702 ASSERT(!clipped); 704 ASSERT(!clipped);
703 705
704 CCLayerQuad::Edge bottomEdge(bottomRight, bottomLeft); 706 CCLayerQuad::Edge bottomEdge(bottomRight, bottomLeft);
705 CCLayerQuad::Edge leftEdge(bottomLeft, topLeft); 707 CCLayerQuad::Edge leftEdge(bottomLeft, topLeft);
706 CCLayerQuad::Edge topEdge(topLeft, topRight); 708 CCLayerQuad::Edge topEdge(topLeft, topRight);
707 CCLayerQuad::Edge rightEdge(topRight, bottomRight); 709 CCLayerQuad::Edge rightEdge(topRight, bottomRight);
708 710
709 // Only apply anti-aliasing to edges not clipped by culling or scissorin g. 711 // Only apply anti-aliasing to edges not clipped by culling or scissorin g.
710 if (quad->topEdgeAA() && tileRect.y() == quad->quadRect().y()) 712 if (quad->topEdgeAA() && tileRect.y() == quad->quadRect().y())
711 topEdge = deviceLayerEdges.top(); 713 topEdge = deviceLayerEdges.top();
712 if (quad->leftEdgeAA() && tileRect.x() == quad->quadRect().x()) 714 if (quad->leftEdgeAA() && tileRect.x() == quad->quadRect().x())
713 leftEdge = deviceLayerEdges.left(); 715 leftEdge = deviceLayerEdges.left();
714 if (quad->rightEdgeAA() && tileRect.maxX() == quad->quadRect().maxX()) 716 if (quad->rightEdgeAA() && tileRect.max_x() == quad->quadRect().max_x())
715 rightEdge = deviceLayerEdges.right(); 717 rightEdge = deviceLayerEdges.right();
716 if (quad->bottomEdgeAA() && tileRect.maxY() == quad->quadRect().maxY()) 718 if (quad->bottomEdgeAA() && tileRect.max_y() == quad->quadRect().max_y() )
717 bottomEdge = deviceLayerEdges.bottom(); 719 bottomEdge = deviceLayerEdges.bottom();
718 720
719 float sign = FloatQuad(tileRect).isCounterclockwise() ? -1 : 1; 721 float sign = FloatQuad(cc::IntRect(tileRect)).isCounterclockwise() ? -1 : 1;
720 bottomEdge.scale(sign); 722 bottomEdge.scale(sign);
721 leftEdge.scale(sign); 723 leftEdge.scale(sign);
722 topEdge.scale(sign); 724 topEdge.scale(sign);
723 rightEdge.scale(sign); 725 rightEdge.scale(sign);
724 726
725 // Create device space quad. 727 // Create device space quad.
726 CCLayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge); 728 CCLayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge);
727 729
728 // Map device space quad to local space. contentsDeviceTransform has no 3d component since it was generated with to2dTransform() so we don't need to pro ject. 730 // Map device space quad to local space. contentsDeviceTransform has no 3d component since it was generated with to2dTransform() so we don't need to pro ject.
729 WebTransformationMatrix inverseDeviceTransform = deviceTransform.inverse (); 731 WebTransformationMatrix inverseDeviceTransform = deviceTransform.inverse ();
(...skipping 22 matching lines...) Expand all
752 localQuad.scale(1.0f / tileRect.width(), 1.0f / tileRect.height()); 754 localQuad.scale(1.0f / tileRect.width(), 1.0f / tileRect.height());
753 755
754 setShaderOpacity(quad->opacity(), uniforms.alphaLocation); 756 setShaderOpacity(quad->opacity(), uniforms.alphaLocation);
755 setShaderFloatQuad(localQuad, uniforms.pointLocation); 757 setShaderFloatQuad(localQuad, uniforms.pointLocation);
756 758
757 // The tile quad shader behaves differently compared to all other shaders. 759 // The tile quad shader behaves differently compared to all other shaders.
758 // The transform and vertex data are used to figure out the extents that the 760 // The transform and vertex data are used to figure out the extents that the
759 // un-antialiased quad should have and which vertex this is and the float 761 // un-antialiased quad should have and which vertex this is and the float
760 // quad passed in via uniform is the actual geometry that gets used to draw 762 // quad passed in via uniform is the actual geometry that gets used to draw
761 // it. This is why this centered rect is used and not the original quadRect. 763 // it. This is why this centered rect is used and not the original quadRect.
762 FloatRect centeredRect(FloatPoint(-0.5 * tileRect.width(), -0.5 * tileRect.h eight()), tileRect.size()); 764 ccmath::FloatRect centeredRect(ccmath::FloatPoint(-0.5 * tileRect.width(), - 0.5 * tileRect.height()), tileRect.size());
763 drawQuadGeometry(frame, quad->quadTransform(), centeredRect, uniforms.matrix Location); 765 drawQuadGeometry(frame, quad->quadTransform(), centeredRect, uniforms.matrix Location);
764 } 766 }
765 767
766 void CCRendererGL::drawYUVVideoQuad(const DrawingFrame& frame, const CCYUVVideoD rawQuad* quad) 768 void CCRendererGL::drawYUVVideoQuad(const DrawingFrame& frame, const CCYUVVideoD rawQuad* quad)
767 { 769 {
768 const VideoYUVProgram* program = videoYUVProgram(); 770 const VideoYUVProgram* program = videoYUVProgram();
769 ASSERT(program && program->initialized()); 771 ASSERT(program && program->initialized());
770 772
771 const CCVideoLayerImpl::FramePlane& yPlane = quad->yPlane(); 773 const CCVideoLayerImpl::FramePlane& yPlane = quad->yPlane();
772 const CCVideoLayerImpl::FramePlane& uPlane = quad->uPlane(); 774 const CCVideoLayerImpl::FramePlane& uPlane = quad->uPlane();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 { 874 {
873 ASSERT(CCProxy::isImplThread()); 875 ASSERT(CCProxy::isImplThread());
874 876
875 TexTransformTextureProgramBinding binding; 877 TexTransformTextureProgramBinding binding;
876 if (quad->flipped()) 878 if (quad->flipped())
877 binding.set(textureProgramFlip()); 879 binding.set(textureProgramFlip());
878 else 880 else
879 binding.set(textureProgram()); 881 binding.set(textureProgram());
880 GLC(context(), context()->useProgram(binding.programId)); 882 GLC(context(), context()->useProgram(binding.programId));
881 GLC(context(), context()->uniform1i(binding.samplerLocation, 0)); 883 GLC(context(), context()->uniform1i(binding.samplerLocation, 0));
882 const FloatRect& uvRect = quad->uvRect(); 884 const ccmath::FloatRect& uvRect = quad->uvRect();
883 GLC(context(), context()->uniform4f(binding.texTransformLocation, uvRect.x() , uvRect.y(), uvRect.width(), uvRect.height())); 885 GLC(context(), context()->uniform4f(binding.texTransformLocation, uvRect.x() , uvRect.y(), uvRect.width(), uvRect.height()));
884 886
885 GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); 887 GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0));
886 CCResourceProvider::ScopedReadLockGL quadResourceLock(m_resourceProvider, qu ad->resourceId()); 888 CCResourceProvider::ScopedReadLockGL quadResourceLock(m_resourceProvider, qu ad->resourceId());
887 GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quadRes ourceLock.textureId())); 889 GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quadRes ourceLock.textureId()));
888 890
889 // FIXME: setting the texture parameters every time is redundant. Move this code somewhere 891 // FIXME: setting the texture parameters every time is redundant. Move this code somewhere
890 // where it will only happen once per texture. 892 // where it will only happen once per texture.
891 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph icsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); 893 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph icsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR));
892 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph icsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); 894 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph icsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 932
931 setShaderOpacity(quad->opacity(), binding.alphaLocation); 933 setShaderOpacity(quad->opacity(), binding.alphaLocation);
932 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), binding.mat rixLocation); 934 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), binding.mat rixLocation);
933 935
934 GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, 0 )); 936 GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, 0 ));
935 } 937 }
936 938
937 void CCRendererGL::finishDrawingFrame(DrawingFrame& frame) 939 void CCRendererGL::finishDrawingFrame(DrawingFrame& frame)
938 { 940 {
939 m_currentFramebufferLock.clear(); 941 m_currentFramebufferLock.clear();
940 m_swapBufferRect.unite(enclosingIntRect(frame.rootDamageRect)); 942 m_swapBufferRect.Unite(frame.rootDamageRect.EnclosingIntRect());
941 943
942 GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST)); 944 GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST));
943 GLC(m_context, m_context->disable(GraphicsContext3D::BLEND)); 945 GLC(m_context, m_context->disable(GraphicsContext3D::BLEND));
944 } 946 }
945 947
946 bool CCRendererGL::flippedFramebuffer() const 948 bool CCRendererGL::flippedFramebuffer() const
947 { 949 {
948 return true; 950 return true;
949 } 951 }
950 952
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 point[7] = quad.p4().y(); 986 point[7] = quad.p4().y();
985 GLC(m_context, m_context->uniform2fv(quadLocation, 4, point)); 987 GLC(m_context, m_context->uniform2fv(quadLocation, 4, point));
986 } 988 }
987 989
988 void CCRendererGL::setShaderOpacity(float opacity, int alphaLocation) 990 void CCRendererGL::setShaderOpacity(float opacity, int alphaLocation)
989 { 991 {
990 if (alphaLocation != -1) 992 if (alphaLocation != -1)
991 GLC(m_context, m_context->uniform1f(alphaLocation, opacity)); 993 GLC(m_context, m_context->uniform1f(alphaLocation, opacity));
992 } 994 }
993 995
994 void CCRendererGL::drawQuadGeometry(const DrawingFrame& frame, const WebKit::Web TransformationMatrix& drawTransform, const FloatRect& quadRect, int matrixLocati on) 996 void CCRendererGL::drawQuadGeometry(const DrawingFrame& frame, const WebKit::Web TransformationMatrix& drawTransform, const ccmath::FloatRect& quadRect, int matr ixLocation)
995 { 997 {
996 WebTransformationMatrix quadRectMatrix; 998 WebTransformationMatrix quadRectMatrix;
997 quadRectTransform(&quadRectMatrix, drawTransform, quadRect); 999 quadRectTransform(&quadRectMatrix, drawTransform, quadRect);
998 static float glMatrix[16]; 1000 static float glMatrix[16];
999 toGLMatrix(&glMatrix[0], frame.projectionMatrix * quadRectMatrix); 1001 toGLMatrix(&glMatrix[0], frame.projectionMatrix * quadRectMatrix);
1000 GLC(m_context, m_context->uniformMatrix4fv(matrixLocation, 1, false, &glMatr ix[0])); 1002 GLC(m_context, m_context->uniformMatrix4fv(matrixLocation, 1, false, &glMatr ix[0]));
1001 1003
1002 GLC(m_context, m_context->drawElements(GraphicsContext3D::TRIANGLES, 6, Grap hicsContext3D::UNSIGNED_SHORT, 0)); 1004 GLC(m_context, m_context->drawElements(GraphicsContext3D::TRIANGLES, 6, Grap hicsContext3D::UNSIGNED_SHORT, 0));
1003 } 1005 }
1004 1006
1005 void CCRendererGL::copyTextureToFramebuffer(const DrawingFrame& frame, int textu reId, const IntRect& rect, const WebTransformationMatrix& drawMatrix) 1007 void CCRendererGL::copyTextureToFramebuffer(const DrawingFrame& frame, int textu reId, const ccmath::IntRect& rect, const WebTransformationMatrix& drawMatrix)
1006 { 1008 {
1007 const RenderPassProgram* program = renderPassProgram(); 1009 const RenderPassProgram* program = renderPassProgram();
1008 1010
1009 GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); 1011 GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0));
1010 GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, texture Id)); 1012 GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, texture Id));
1011 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph icsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); 1013 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph icsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR));
1012 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph icsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); 1014 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph icsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR));
1013 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph icsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); 1015 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph icsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
1014 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph icsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); 1016 GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, Graph icsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
1015 1017
(...skipping 12 matching lines...) Expand all
1028 bool CCRendererGL::swapBuffers() 1030 bool CCRendererGL::swapBuffers()
1029 { 1031 {
1030 ASSERT(m_visible); 1032 ASSERT(m_visible);
1031 ASSERT(!m_isFramebufferDiscarded); 1033 ASSERT(!m_isFramebufferDiscarded);
1032 1034
1033 TRACE_EVENT0("cc", "CCRendererGL::swapBuffers"); 1035 TRACE_EVENT0("cc", "CCRendererGL::swapBuffers");
1034 // We're done! Time to swapbuffers! 1036 // We're done! Time to swapbuffers!
1035 1037
1036 if (m_capabilities.usingPartialSwap) { 1038 if (m_capabilities.usingPartialSwap) {
1037 // If supported, we can save significant bandwidth by only swapping the damaged/scissored region (clamped to the viewport) 1039 // If supported, we can save significant bandwidth by only swapping the damaged/scissored region (clamped to the viewport)
1038 m_swapBufferRect.intersect(IntRect(IntPoint(), viewportSize())); 1040 m_swapBufferRect.Intersect(ccmath::IntRect(ccmath::IntPoint(), viewportS ize()));
1039 int flippedYPosOfRectBottom = viewportHeight() - m_swapBufferRect.y() - m_swapBufferRect.height(); 1041 int flippedYPosOfRectBottom = viewportHeight() - m_swapBufferRect.y() - m_swapBufferRect.height();
1040 m_context->postSubBufferCHROMIUM(m_swapBufferRect.x(), flippedYPosOfRect Bottom, m_swapBufferRect.width(), m_swapBufferRect.height()); 1042 m_context->postSubBufferCHROMIUM(m_swapBufferRect.x(), flippedYPosOfRect Bottom, m_swapBufferRect.width(), m_swapBufferRect.height());
1041 } else { 1043 } else {
1042 // Note that currently this has the same effect as swapBuffers; we shoul d 1044 // Note that currently this has the same effect as swapBuffers; we shoul d
1043 // consider exposing a different entry point on WebGraphicsContext3D. 1045 // consider exposing a different entry point on WebGraphicsContext3D.
1044 m_context->prepareTexture(); 1046 m_context->prepareTexture();
1045 } 1047 }
1046 1048
1047 m_swapBufferRect = IntRect(); 1049 m_swapBufferRect = ccmath::IntRect();
1048 1050
1049 return true; 1051 return true;
1050 } 1052 }
1051 1053
1052 void CCRendererGL::onSwapBuffersComplete() 1054 void CCRendererGL::onSwapBuffersComplete()
1053 { 1055 {
1054 m_client->onSwapBuffersComplete(); 1056 m_client->onSwapBuffersComplete();
1055 } 1057 }
1056 1058
1057 void CCRendererGL::onMemoryAllocationChanged(WebGraphicsMemoryAllocation allocat ion) 1059 void CCRendererGL::onMemoryAllocationChanged(WebGraphicsMemoryAllocation allocat ion)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 m_context->ensureFramebufferCHROMIUM(); 1112 m_context->ensureFramebufferCHROMIUM();
1111 m_isFramebufferDiscarded = false; 1113 m_isFramebufferDiscarded = false;
1112 } 1114 }
1113 1115
1114 void CCRendererGL::onContextLost() 1116 void CCRendererGL::onContextLost()
1115 { 1117 {
1116 m_client->didLoseContext(); 1118 m_client->didLoseContext();
1117 } 1119 }
1118 1120
1119 1121
1120 void CCRendererGL::getFramebufferPixels(void *pixels, const IntRect& rect) 1122 void CCRendererGL::getFramebufferPixels(void *pixels, const cc::IntRect& rect)
1121 { 1123 {
1122 ASSERT(rect.maxX() <= viewportWidth() && rect.maxY() <= viewportHeight()); 1124 ASSERT(rect.maxX() <= viewportWidth() && rect.maxY() <= viewportHeight());
1123 1125
1124 if (!pixels) 1126 if (!pixels)
1125 return; 1127 return;
1126 1128
1127 makeContextCurrent(); 1129 makeContextCurrent();
1128 1130
1129 bool doWorkaround = needsIOSurfaceReadbackWorkaround(); 1131 bool doWorkaround = needsIOSurfaceReadbackWorkaround();
1130 1132
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 releaseRenderPassTextures(); 1189 releaseRenderPassTextures();
1188 m_client->releaseContentsTextures(); 1190 m_client->releaseContentsTextures();
1189 GLC(m_context, m_context->flush()); 1191 GLC(m_context, m_context->flush());
1190 } 1192 }
1191 } 1193 }
1192 1194
1193 bool CCRendererGL::getFramebufferTexture(CCScopedTexture* texture, const IntRect & deviceRect) 1195 bool CCRendererGL::getFramebufferTexture(CCScopedTexture* texture, const IntRect & deviceRect)
1194 { 1196 {
1195 ASSERT(!texture->id() || (texture->size() == deviceRect.size() && texture->f ormat() == GraphicsContext3D::RGB)); 1197 ASSERT(!texture->id() || (texture->size() == deviceRect.size() && texture->f ormat() == GraphicsContext3D::RGB));
1196 1198
1197 if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, deviceRect.si ze(), GraphicsContext3D::RGB, CCResourceProvider::TextureUsageAny)) 1199 if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, cc::IntSize(d eviceRect.size()), GraphicsContext3D::RGB, CCResourceProvider::TextureUsageAny))
1198 return false; 1200 return false;
1199 1201
1200 CCResourceProvider::ScopedWriteLockGL lock(m_resourceProvider, texture->id() ); 1202 CCResourceProvider::ScopedWriteLockGL lock(m_resourceProvider, texture->id() );
1201 GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.te xtureId())); 1203 GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.te xtureId()));
1202 GLC(m_context, m_context->copyTexImage2D(GraphicsContext3D::TEXTURE_2D, 0, t exture->format(), 1204 GLC(m_context, m_context->copyTexImage2D(GraphicsContext3D::TEXTURE_2D, 0, t exture->format(),
1203 deviceRect.x(), deviceRect.y(), dev iceRect.width(), deviceRect.height(), 0)); 1205 deviceRect.x(), deviceRect.y(), dev iceRect.width(), deviceRect.height(), 0));
1204 return true; 1206 return true;
1205 } 1207 }
1206 1208
1207 bool CCRendererGL::useScopedTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& viewportRect) 1209 bool CCRendererGL::useScopedTexture(DrawingFrame& frame, const CCScopedTexture* texture, const ccmath::IntRect& viewportRect)
1208 { 1210 {
1209 ASSERT(texture->id()); 1211 ASSERT(texture->id());
1210 frame.currentRenderPass = 0; 1212 frame.currentRenderPass = 0;
1211 frame.currentTexture = texture; 1213 frame.currentTexture = texture;
1212 1214
1213 return bindFramebufferToTexture(frame, texture, viewportRect); 1215 return bindFramebufferToTexture(frame, texture, viewportRect);
1214 } 1216 }
1215 1217
1216 void CCRendererGL::bindFramebufferToOutputSurface(DrawingFrame& frame) 1218 void CCRendererGL::bindFramebufferToOutputSurface(DrawingFrame& frame)
1217 { 1219 {
1218 m_currentFramebufferLock.clear(); 1220 m_currentFramebufferLock.clear();
1219 GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0) ); 1221 GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0) );
1220 } 1222 }
1221 1223
1222 bool CCRendererGL::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedT exture* texture, const IntRect& framebufferRect) 1224 bool CCRendererGL::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedT exture* texture, const ccmath::IntRect& framebufferRect)
1223 { 1225 {
1224 ASSERT(texture->id()); 1226 ASSERT(texture->id());
1225 1227
1226 GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_ offscreenFramebufferId)); 1228 GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_ offscreenFramebufferId));
1227 m_currentFramebufferLock = adoptPtr(new CCResourceProvider::ScopedWriteLockG L(m_resourceProvider, texture->id())); 1229 m_currentFramebufferLock = adoptPtr(new CCResourceProvider::ScopedWriteLockG L(m_resourceProvider, texture->id()));
1228 unsigned textureId = m_currentFramebufferLock->textureId(); 1230 unsigned textureId = m_currentFramebufferLock->textureId();
1229 GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFE R, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, textureI d, 0)); 1231 GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFE R, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, textureI d, 0));
1230 1232
1231 #if !defined ( NDEBUG ) 1233 #if !defined ( NDEBUG )
1232 if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != Gra phicsContext3D::FRAMEBUFFER_COMPLETE) { 1234 if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != Gra phicsContext3D::FRAMEBUFFER_COMPLETE) {
1233 ASSERT_NOT_REACHED(); 1235 ASSERT_NOT_REACHED();
1234 return false; 1236 return false;
1235 } 1237 }
1236 #endif 1238 #endif
1237 1239
1238 initializeMatrices(frame, framebufferRect, false); 1240 initializeMatrices(frame, framebufferRect, false);
1239 setDrawViewportSize(framebufferRect.size()); 1241 setDrawViewportSize(framebufferRect.size());
1240 1242
1241 return true; 1243 return true;
1242 } 1244 }
1243 1245
1244 void CCRendererGL::enableScissorTestRect(const IntRect& scissorRect) 1246 void CCRendererGL::enableScissorTestRect(const ccmath::IntRect& scissorRect)
1245 { 1247 {
1246 GLC(m_context, m_context->enable(GraphicsContext3D::SCISSOR_TEST)); 1248 GLC(m_context, m_context->enable(GraphicsContext3D::SCISSOR_TEST));
1247 GLC(m_context, m_context->scissor(scissorRect.x(), scissorRect.y(), scissorR ect.width(), scissorRect.height())); 1249 GLC(m_context, m_context->scissor(scissorRect.x(), scissorRect.y(), scissorR ect.width(), scissorRect.height()));
1248 } 1250 }
1249 1251
1250 void CCRendererGL::disableScissorTest() 1252 void CCRendererGL::disableScissorTest()
1251 { 1253 {
1252 GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST)); 1254 GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST));
1253 } 1255 }
1254 1256
1255 void CCRendererGL::setDrawViewportSize(const IntSize& viewportSize) 1257 void CCRendererGL::setDrawViewportSize(const ccmath::IntSize& viewportSize)
1256 { 1258 {
1257 GLC(m_context, m_context->viewport(0, 0, viewportSize.width(), viewportSize. height())); 1259 GLC(m_context, m_context->viewport(0, 0, viewportSize.width(), viewportSize. height()));
1258 } 1260 }
1259 1261
1260 bool CCRendererGL::makeContextCurrent() 1262 bool CCRendererGL::makeContextCurrent()
1261 { 1263 {
1262 return m_context->makeContextCurrent(); 1264 return m_context->makeContextCurrent();
1263 } 1265 }
1264 1266
1265 bool CCRendererGL::initializeSharedObjects() 1267 bool CCRendererGL::initializeSharedObjects()
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 } 1520 }
1519 1521
1520 bool CCRendererGL::isContextLost() 1522 bool CCRendererGL::isContextLost()
1521 { 1523 {
1522 return (m_context->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERRO R); 1524 return (m_context->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERRO R);
1523 } 1525 }
1524 1526
1525 } // namespace cc 1527 } // namespace cc
1526 1528
1527 #endif // USE(ACCELERATED_COMPOSITING) 1529 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « cc/CCRendererGL.h ('k') | cc/CCRendererSoftware.h » ('j') | cc/math/clamp.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698