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

Side by Side Diff: src/device/xps/SkXPSDevice.cpp

Issue 22978012: Split SkDevice into SkBaseDevice and SkBitmapDevice (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Updating to ToT (10994) Created 7 years, 3 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
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | src/effects/SkColorFilterImageFilter.cpp » ('j') | 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 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 #ifndef UNICODE 8 #ifndef UNICODE
9 #define UNICODE 9 #define UNICODE
10 #endif 10 #endif
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return S_OK; 104 return S_OK;
105 } 105 }
106 106
107 static SkBitmap make_fake_bitmap(int width, int height) { 107 static SkBitmap make_fake_bitmap(int width, int height) {
108 SkBitmap bitmap; 108 SkBitmap bitmap;
109 bitmap.setConfig(SkBitmap::kNo_Config, width, height); 109 bitmap.setConfig(SkBitmap::kNo_Config, width, height);
110 return bitmap; 110 return bitmap;
111 } 111 }
112 112
113 SkXPSDevice::SkXPSDevice() 113 SkXPSDevice::SkXPSDevice()
114 : SkDevice(make_fake_bitmap(10000, 10000)) 114 : SkBitmapDevice(make_fake_bitmap(10000, 10000))
115 , fCurrentPage(0) { 115 , fCurrentPage(0) {
116 } 116 }
117 117
118 SkXPSDevice::~SkXPSDevice() { 118 SkXPSDevice::~SkXPSDevice() {
119 } 119 }
120 120
121 SkXPSDevice::TypefaceUse::TypefaceUse() 121 SkXPSDevice::TypefaceUse::TypefaceUse()
122 : typefaceId(0xffffffff) 122 : typefaceId(0xffffffff)
123 , fontData(NULL) 123 , fontData(NULL)
124 , xpsFont(NULL) 124 , xpsFont(NULL)
(...skipping 2243 matching lines...) Expand 10 before | Expand all | Expand 10 after
2368 paint)); 2368 paint));
2369 } 2369 }
2370 2370
2371 void SkXPSDevice::drawTextOnPath(const SkDraw& d, const void* text, size_t len, 2371 void SkXPSDevice::drawTextOnPath(const SkDraw& d, const void* text, size_t len,
2372 const SkPath& path, const SkMatrix* matrix, 2372 const SkPath& path, const SkMatrix* matrix,
2373 const SkPaint& paint) { 2373 const SkPaint& paint) {
2374 //This will call back into the device to do the drawing. 2374 //This will call back into the device to do the drawing.
2375 d.drawTextOnPath((const char*)text, len, path, matrix, paint); 2375 d.drawTextOnPath((const char*)text, len, path, matrix, paint);
2376 } 2376 }
2377 2377
2378 void SkXPSDevice::drawDevice(const SkDraw& d, SkDevice* dev, 2378 void SkXPSDevice::drawDevice(const SkDraw& d, SkBaseDevice* dev,
2379 int x, int y, 2379 int x, int y,
2380 const SkPaint&) { 2380 const SkPaint&) {
2381 SkXPSDevice* that = static_cast<SkXPSDevice*>(dev); 2381 SkXPSDevice* that = static_cast<SkXPSDevice*>(dev);
2382 2382
2383 SkTScopedComPtr<IXpsOMMatrixTransform> xpsTransform; 2383 SkTScopedComPtr<IXpsOMMatrixTransform> xpsTransform;
2384 XPS_MATRIX rawTransform = { 2384 XPS_MATRIX rawTransform = {
2385 1.0f, 2385 1.0f,
2386 0.0f, 2386 0.0f,
2387 0.0f, 2387 0.0f,
2388 1.0f, 2388 1.0f,
(...skipping 11 matching lines...) Expand all
2400 "Could not get current visuals for layer."); 2400 "Could not get current visuals for layer.");
2401 HRVM(currentVisuals->Append(that->fCurrentXpsCanvas.get()), 2401 HRVM(currentVisuals->Append(that->fCurrentXpsCanvas.get()),
2402 "Could not add layer to current visuals."); 2402 "Could not add layer to current visuals.");
2403 } 2403 }
2404 2404
2405 bool SkXPSDevice::onReadPixels(const SkBitmap& bitmap, int x, int y, 2405 bool SkXPSDevice::onReadPixels(const SkBitmap& bitmap, int x, int y,
2406 SkCanvas::Config8888) { 2406 SkCanvas::Config8888) {
2407 return false; 2407 return false;
2408 } 2408 }
2409 2409
2410 SkDevice* SkXPSDevice::onCreateCompatibleDevice(SkBitmap::Config config, 2410 SkBaseDevice* SkXPSDevice::onCreateCompatibleDevice(SkBitmap::Config config,
2411 int width, int height, 2411 int width, int height,
2412 bool isOpaque, 2412 bool isOpaque,
2413 Usage usage) { 2413 Usage usage) {
2414 if (SkDevice::kGeneral_Usage == usage) { 2414 if (SkBaseDevice::kGeneral_Usage == usage) {
2415 return NULL; 2415 return NULL;
2416 SK_CRASH(); 2416 SK_CRASH();
2417 //To what stream do we write? 2417 //To what stream do we write?
2418 //SkXPSDevice* dev = new SkXPSDevice(this); 2418 //SkXPSDevice* dev = new SkXPSDevice(this);
2419 //SkSize s = SkSize::Make(width, height); 2419 //SkSize s = SkSize::Make(width, height);
2420 //dev->BeginCanvas(s, s, SkMatrix::I()); 2420 //dev->BeginCanvas(s, s, SkMatrix::I());
2421 //return dev; 2421 //return dev;
2422 } 2422 }
2423 2423
2424 return new SkXPSDevice(this->fXpsFactory.get()); 2424 return new SkXPSDevice(this->fXpsFactory.get());
2425 } 2425 }
2426 2426
2427 SkXPSDevice::SkXPSDevice(IXpsOMObjectFactory* xpsFactory) 2427 SkXPSDevice::SkXPSDevice(IXpsOMObjectFactory* xpsFactory)
2428 : SkDevice(make_fake_bitmap(10000, 10000)) 2428 : SkBitmapDevice(make_fake_bitmap(10000, 10000))
2429 , fCurrentPage(0) { 2429 , fCurrentPage(0) {
2430 2430
2431 HRVM(CoCreateInstance( 2431 HRVM(CoCreateInstance(
2432 CLSID_XpsOMObjectFactory, 2432 CLSID_XpsOMObjectFactory,
2433 NULL, 2433 NULL,
2434 CLSCTX_INPROC_SERVER, 2434 CLSCTX_INPROC_SERVER,
2435 IID_PPV_ARGS(&this->fXpsFactory)), 2435 IID_PPV_ARGS(&this->fXpsFactory)),
2436 "Could not create factory for layer."); 2436 "Could not create factory for layer.");
2437 2437
2438 HRVM(this->fXpsFactory->CreateCanvas(&this->fCurrentXpsCanvas), 2438 HRVM(this->fXpsFactory->CreateCanvas(&this->fCurrentXpsCanvas),
2439 "Could not create canvas for layer."); 2439 "Could not create canvas for layer.");
2440 } 2440 }
2441 2441
2442 bool SkXPSDevice::allowImageFilter(SkImageFilter*) { 2442 bool SkXPSDevice::allowImageFilter(SkImageFilter*) {
2443 return false; 2443 return false;
2444 } 2444 }
OLDNEW
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | src/effects/SkColorFilterImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698