Skip to content

Commit

Permalink
mac: Clean up a few more uses of USE_SKIA
Browse files Browse the repository at this point in the history
Likely also fixes a top-down-flipped bug with the in-process command buffer.

BUG=110881
TBR=tony

Review URL: https://codereview.chromium.org/12896006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190469 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
thakis@chromium.org committed Mar 25, 2013
1 parent e9a3b0c commit 1d1cb4a
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 64 deletions.
4 changes: 4 additions & 0 deletions chrome/renderer/mock_printer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
#include "printing/units.h"
#include "testing/gtest/include/gtest/gtest.h"

#if defined(OS_MACOSX)
#include "printing/pdf_metafile_cg_mac.h"
#endif

namespace {

void UpdateMargins(int margins_type, int dpi, PrintMsg_Print_Params* params) {
Expand Down
10 changes: 1 addition & 9 deletions content/browser/gpu/gpu_internals_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,11 @@ base::DictionaryValue* GpuInfoAsDictionaryValue() {
}

// Determine if accelerated-2d-canvas is supported, which depends on whether
// lose_context could happen and whether skia is the backend.
// lose_context could happen.
bool SupportsAccelerated2dCanvas() {
if (GpuDataManagerImpl::GetInstance()->GetGPUInfo().can_lose_context)
return false;
#if defined(USE_SKIA)
return true;
#else
return false;
#endif
}

base::Value* GetFeatureStatus() {
Expand Down Expand Up @@ -595,11 +591,7 @@ base::Value* GpuMessageHandler::OnRequestClientInfo(
base::SysInfo::OperatingSystemName() + " " +
base::SysInfo::OperatingSystemVersion());
dict->SetString("angle_revision", base::UintToString(BUILD_REVISION));
#if defined(USE_SKIA)
dict->SetString("graphics_backend", "Skia");
#else
dict->SetString("graphics_backend", "Core Graphics");
#endif
dict->SetString("blacklist_version",
GpuDataManagerImpl::GetInstance()->GetBlacklistVersion());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,6 @@ void WebGraphicsContext3DCommandBufferImpl::reshape(int width, int height) {
gl_->ResizeCHROMIUM(width, height);
}

#ifdef FLIP_FRAMEBUFFER_VERTICALLY
void WebGraphicsContext3DCommandBufferImpl::FlipVertically(
uint8* framebuffer,
unsigned int width,
Expand All @@ -600,7 +599,6 @@ void WebGraphicsContext3DCommandBufferImpl::FlipVertically(
memcpy(row_a, scanline, row_bytes);
}
}
#endif

bool WebGraphicsContext3DCommandBufferImpl::readBackFramebuffer(
unsigned char* pixels,
Expand Down Expand Up @@ -637,11 +635,9 @@ bool WebGraphicsContext3DCommandBufferImpl::readBackFramebuffer(
gl_->BindFramebuffer(GL_FRAMEBUFFER, bound_fbo_);
}

#ifdef FLIP_FRAMEBUFFER_VERTICALLY
if (pixels) {
FlipVertically(pixels, width, height);
}
#endif

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
#include "ui/gl/gpu_preference.h"
#include "ui/gfx/native_widget_types.h"

#if defined(USE_SKIA)
#define FLIP_FRAMEBUFFER_VERTICALLY
#endif

namespace gpu {

class TransferBuffer;
Expand Down Expand Up @@ -752,12 +748,10 @@ class WebGraphicsContext3DCommandBufferImpl

base::WeakPtrFactory<WebGraphicsContext3DCommandBufferImpl> weak_ptr_factory_;

#ifdef FLIP_FRAMEBUFFER_VERTICALLY
std::vector<uint8> scanline_;
void FlipVertically(uint8* framebuffer,
unsigned int width,
unsigned int height);
#endif

bool initialized_;
WebGraphicsContext3DCommandBufferImpl* parent_;
Expand Down
16 changes: 2 additions & 14 deletions printing/metafile_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,17 @@
#ifndef PRINTING_METAFILE_IMPL_H_
#define PRINTING_METAFILE_IMPL_H_

#include "printing/pdf_metafile_skia.h"

#if defined(OS_WIN)
#include "printing/emf_win.h"
#elif defined(OS_MACOSX)
#include "printing/pdf_metafile_cg_mac.h"
#endif

#if !defined(OS_MACOSX) || defined(USE_SKIA)
#include "printing/pdf_metafile_skia.h"
#endif

namespace printing {

#if defined(OS_WIN)
typedef Emf NativeMetafile;
typedef PdfMetafileSkia PreviewMetafile;
#elif defined(OS_MACOSX)
#if defined(USE_SKIA)
typedef PdfMetafileSkia NativeMetafile;
typedef PdfMetafileSkia PreviewMetafile;
#else
typedef PdfMetafileCg NativeMetafile;
typedef PdfMetafileCg PreviewMetafile;
#endif
#elif defined(OS_POSIX)
typedef PdfMetafileSkia NativeMetafile;
typedef PdfMetafileSkia PreviewMetafile;
Expand Down
4 changes: 0 additions & 4 deletions webkit/glue/webkit_glue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,7 @@ bool DecodeImage(const std::string& image_data, SkBitmap* image) {
if (web_image.isNull())
return false;

#if defined(OS_MACOSX) && !defined(USE_SKIA)
*image = gfx::CGImageToSkBitmap(web_image.getCGImageRef());
#else
*image = web_image.getSkBitmap();
#endif
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,6 @@ void WebGraphicsContext3DInProcessCommandBufferImpl::deleteCompositorTexture(
context_->DeleteParentTexture(parent_texture);
}

#ifdef FLIP_FRAMEBUFFER_VERTICALLY
void WebGraphicsContext3DInProcessCommandBufferImpl::FlipVertically(
uint8* framebuffer,
unsigned int width,
Expand All @@ -745,7 +744,6 @@ void WebGraphicsContext3DInProcessCommandBufferImpl::FlipVertically(
memcpy(row_a, scanline, row_bytes);
}
}
#endif

bool WebGraphicsContext3DInProcessCommandBufferImpl::readBackFramebuffer(
unsigned char* pixels,
Expand Down Expand Up @@ -782,11 +780,9 @@ bool WebGraphicsContext3DInProcessCommandBufferImpl::readBackFramebuffer(
gl_->BindFramebuffer(GL_FRAMEBUFFER, bound_fbo_);
}

#ifdef FLIP_FRAMEBUFFER_VERTICALLY
if (pixels) {
FlipVertically(pixels, width, height);
}
#endif

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
#include "ui/gfx/native_widget_types.h"
#include "webkit/gpu/webkit_gpu_export.h"

#if defined(USE_SKIA)
#define FLIP_FRAMEBUFFER_VERTICALLY
#endif

namespace gpu {
namespace gles2 {
class GLES2Implementation;
Expand Down Expand Up @@ -557,12 +553,10 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
// Errors raised by synthesizeGLError().
std::vector<WGC3Denum> synthetic_errors_;

#ifdef FLIP_FRAMEBUFFER_VERTICALLY
std::vector<uint8> scanline_;
void FlipVertically(uint8* framebuffer,
unsigned int width,
unsigned int height);
#endif
};

} // namespace gpu
Expand Down
10 changes: 0 additions & 10 deletions webkit/gpu/webgraphicscontext3d_in_process_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ WebGraphicsContext3DInProcessImpl::WebGraphicsContext3DInProcessImpl(
multisample_color_buffer_(0),
bound_fbo_(0),
bound_texture_(0),
#ifdef FLIP_FRAMEBUFFER_VERTICALLY
scanline_(0),
#endif
gl_context_(context),
gl_surface_(surface),
fragment_compiler_(0),
Expand Down Expand Up @@ -103,10 +101,8 @@ WebGraphicsContext3DInProcessImpl::~WebGraphicsContext3DInProcessImpl() {
glDeleteRenderbuffersEXT(1, &depth_stencil_buffer_);
}
glDeleteTextures(1, &texture_);
#ifdef FLIP_FRAMEBUFFER_VERTICALLY
if (scanline_)
delete[] scanline_;
#endif
glDeleteFramebuffersEXT(1, &fbo_);

gl_context_->ReleaseCurrent(gl_surface_.get());
Expand Down Expand Up @@ -390,13 +386,11 @@ void WebGraphicsContext3DInProcessImpl::reshape(int width, int height) {
if (must_restore_fbo)
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, bound_fbo_);

#ifdef FLIP_FRAMEBUFFER_VERTICALLY
if (scanline_) {
delete[] scanline_;
scanline_ = 0;
}
scanline_ = new unsigned char[width * 4];
#endif // FLIP_FRAMEBUFFER_VERTICALLY
}

bool WebGraphicsContext3DInProcessImpl::AllocateOffscreenFrameBuffer(
Expand Down Expand Up @@ -623,7 +617,6 @@ void WebGraphicsContext3DInProcessImpl::ClearRenderTarget() {
glDisable(GL_DITHER);
}

#ifdef FLIP_FRAMEBUFFER_VERTICALLY
void WebGraphicsContext3DInProcessImpl::FlipVertically(
unsigned char* framebuffer, unsigned int width, unsigned int height) {
unsigned char* scanline = scanline_;
Expand All @@ -643,7 +636,6 @@ void WebGraphicsContext3DInProcessImpl::FlipVertically(
memcpy(row_a, scanline, row_bytes);
}
}
#endif

bool WebGraphicsContext3DInProcessImpl::readBackFramebuffer(
unsigned char* pixels, size_t bufferSize, WebGLId framebuffer,
Expand Down Expand Up @@ -696,10 +688,8 @@ bool WebGraphicsContext3DInProcessImpl::readBackFramebuffer(

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, bound_fbo_);

#ifdef FLIP_FRAMEBUFFER_VERTICALLY
if (pixels)
FlipVertically(pixels, width, height);
#endif

return true;
}
Expand Down
7 changes: 0 additions & 7 deletions webkit/gpu/webgraphicscontext3d_in_process_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
#include "ui/gfx/native_widget_types.h"
#include "webkit/gpu/webkit_gpu_export.h"

#if !defined(OS_MACOSX)
#define FLIP_FRAMEBUFFER_VERTICALLY
#endif
namespace gfx {
class GLContext;
class GLSurface;
Expand Down Expand Up @@ -515,11 +512,9 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessImpl :
bool AllocateOffscreenFrameBuffer(int width, int height);
void ClearRenderTarget();

#ifdef FLIP_FRAMEBUFFER_VERTICALLY
void FlipVertically(unsigned char* framebuffer,
unsigned int width,
unsigned int height);
#endif

// Take into account the user's requested context creation attributes, in
// particular stencil and antialias, and determine which could or could
Expand Down Expand Up @@ -560,9 +555,7 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessImpl :
// For tracking which texture is bound
WebGLId bound_texture_;

#ifdef FLIP_FRAMEBUFFER_VERTICALLY
unsigned char* scanline_;
#endif

// Errors raised by synthesizeGLError().
std::list<WGC3Denum> synthetic_errors_list_;
Expand Down

0 comments on commit 1d1cb4a

Please sign in to comment.