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

Side by Side Diff: Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp

Issue 7125002: Merge 87960 - 2011-06-02 Adrienne Walker <enne@google.com> (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/782/
Patch Set: Created 9 years, 6 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
« no previous file with comments | « Source/WebCore/ChangeLog ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 { 103 {
104 PlatformCanvas::Painter painter(&canvas, PlatformCanvas::Painter::Graysc aleText); 104 PlatformCanvas::Painter painter(&canvas, PlatformCanvas::Painter::Graysc aleText);
105 drawHudContents(painter.context(), hudSize); 105 drawHudContents(painter.context(), hudSize);
106 } 106 }
107 107
108 // Upload to GL. 108 // Upload to GL.
109 { 109 {
110 PlatformCanvas::AutoLocker locker(&canvas); 110 PlatformCanvas::AutoLocker locker(&canvas);
111 111
112 m_hudTexture->bindTexture(); 112 m_hudTexture->bindTexture();
113 bool uploadedViaMap = false;
113 if (m_useMapSubForUploads) { 114 if (m_useMapSubForUploads) {
114 Extensions3DChromium* extensions = static_cast<Extensions3DChromium* >(context->getExtensions()); 115 Extensions3DChromium* extensions = static_cast<Extensions3DChromium* >(context->getExtensions());
115 uint8_t* pixelDest = static_cast<uint8_t*>(extensions->mapTexSubImag e2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, hudSize.width(), hudSize.hei ght(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DCh romium::WRITE_ONLY)); 116 uint8_t* pixelDest = static_cast<uint8_t*>(extensions->mapTexSubImag e2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, hudSize.width(), hudSize.hei ght(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DCh romium::WRITE_ONLY));
116 memcpy(pixelDest, locker.pixels(), hudSize.width() * hudSize.height( ) * 4); 117
117 extensions->unmapTexSubImage2DCHROMIUM(pixelDest); 118 if (pixelDest) {
118 } else 119 uploadedViaMap = true;
120 memcpy(pixelDest, locker.pixels(), hudSize.width() * hudSize.hei ght() * 4);
121 extensions->unmapTexSubImage2DCHROMIUM(pixelDest);
122 }
123 }
124
125 if (!uploadedViaMap) {
119 GLC(context, context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, G raphicsContext3D::RGBA, canvas.size().width(), canvas.size().height(), 0, Graphi csContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, locker.pixels())); 126 GLC(context, context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, G raphicsContext3D::RGBA, canvas.size().width(), canvas.size().height(), 0, Graphi csContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, locker.pixels()));
127 }
120 } 128 }
121 129
122 // Draw the HUD onto the default render surface. 130 // Draw the HUD onto the default render surface.
123 const Program* program = m_layerRenderer->headsUpDisplayProgram(); 131 const Program* program = m_layerRenderer->headsUpDisplayProgram();
124 ASSERT(program && program->initialized()); 132 ASSERT(program && program->initialized());
125 GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE0)); 133 GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE0));
126 m_hudTexture->bindTexture(); 134 m_hudTexture->bindTexture();
127 GLC(context, context->useProgram(program->program())); 135 GLC(context, context->useProgram(program->program()));
128 GLC(context, context->uniform1i(program->fragmentShader().samplerLocation(), 0)); 136 GLC(context, context->uniform1i(program->fragmentShader().samplerLocation(), 0));
129 137
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 240 }
233 241
234 void CCHeadsUpDisplay::onPresent() 242 void CCHeadsUpDisplay::onPresent()
235 { 243 {
236 m_currentFrameNumber += 1; 244 m_currentFrameNumber += 1;
237 } 245 }
238 246
239 } 247 }
240 248
241 #endif // USE(ACCELERATED_COMPOSITING) 249 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « Source/WebCore/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698