HGDIOBJ selected_bitmap = GetCurrentObject(dc, OBJ_BITMAP);
bool succeeded = false;
if (selected_bitmap != NULL) {
- BITMAP bitmap_data;
+ BITMAP bitmap_data = {0};
if (GetObject(selected_bitmap, sizeof(BITMAP), &bitmap_data) ==
sizeof(BITMAP)) {
// The context has a bitmap attached. Attach our SkBitmap to it.
return hdc_;
}
-uint32_t VectorPlatformDeviceEmf::getDeviceCapabilities() {
- return SkBitmapDevice::getDeviceCapabilities() | kVector_Capability;
-}
-
void VectorPlatformDeviceEmf::drawPaint(const SkDraw& draw,
const SkPaint& paint) {
// TODO(maruel): Bypass the current transformation matrix.
fSavedTextColor = GetTextColor(hdc);
SetTextColor(hdc, skia::SkColorToCOLORREF(paint.getColor()));
- LOGFONT lf;
+ LOGFONT lf = {0};
SkLOGFONTFromTypeface(paint.getTypeface(), &lf);
lf.lfHeight = -SkScalarRoundToInt(paint.getTextSize());
fNewFont = CreateFontIndirect(&lf);
void EnsureTypefaceCharactersAccessible(
const SkTypeface& typeface, const wchar_t* text, unsigned int text_length) {
- LOGFONT lf;
+ LOGFONT lf = {0};
SkLOGFONTFromTypeface(&typeface, &lf);
g_skia_ensure_typeface_characters_accessible(lf, text, text_length);
}
characters);
success = ExtTextOut(hdc, x, y, options, lprect, text, characters, lpDx);
if (!success) {
- LOGFONT lf;
+ LOGFONT lf = {0};
SkLOGFONTFromTypeface(typeface, &lf);
VLOG(1) << "SkFontHost::EnsureTypefaceCharactersAccessible FAILED for "
<< " FaceName = " << lf.lfFaceName
SkGDIFontSetup setup;
bool useDrawText = true;
- if (2 == scalarsPerPos
- && SkPaint::kUTF8_TextEncoding != paint.getTextEncoding()
- && setup.useGDI(hdc_, paint)) {
+ if (scalarsPerPos == 2 && len >= 2 &&
+ SkPaint::kUTF8_TextEncoding != paint.getTextEncoding() &&
+ setup.useGDI(hdc_, paint)) {
int startX = SkScalarRoundToInt(pos[0]);
int startY = SkScalarRoundToInt(pos[1] + getAscent(paint));
const int count = len >> 1;
advances[i] = SkScalarRoundToInt(pos[2] - pos[0]);
pos += 2;
}
+ advances[count - 1] = 0;
useDrawText = !EnsureExtTextOut(hdc_, startX, startY,
getTextOutOptions(paint), 0, reinterpret_cast<const wchar_t*>(text),
count, advances, paint.getTypeface());
LoadClippingRegionToDC(hdc_, clip_region_, t);
}
+#ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG
SkBaseDevice* VectorPlatformDeviceEmf::onCreateCompatibleDevice(
SkBitmap::Config config, int width, int height, bool isOpaque,
Usage /*usage*/) {
SkASSERT(config == SkBitmap::kARGB_8888_Config);
return VectorPlatformDeviceEmf::CreateDevice(width, height, isOpaque, NULL);
}
+#endif
+
+SkBaseDevice* VectorPlatformDeviceEmf::onCreateDevice(const SkImageInfo& info,
+ Usage /*usage*/) {
+ SkASSERT(info.colorType() == kPMColor_SkColorType);
+ return VectorPlatformDeviceEmf::CreateDevice(
+ info.width(), info.height(), info.isOpaque(), NULL);
+}
bool VectorPlatformDeviceEmf::CreateBrush(bool use_brush, COLORREF color) {
SkASSERT(previous_brush_ == NULL);
}
// Load a custom pen.
- LOGBRUSH brush;
+ LOGBRUSH brush = {0};
brush.lbStyle = BS_SOLID;
brush.lbColor = color;
brush.lbHatch = 0;
// Create a BMP v4 header that we can serialize. We use the shared "V3"
// fillter to fill the stardard items, then add in the "V4" stuff we want.
- BITMAPV4HEADER bitmap_header;
- memset(&bitmap_header, 0, sizeof(BITMAPV4HEADER));
+ BITMAPV4HEADER bitmap_header = {0};
FillBitmapInfoHeader(src_size_x, src_size_y,
reinterpret_cast<BITMAPINFOHEADER*>(&bitmap_header));
bitmap_header.bV4Size = sizeof(BITMAPV4HEADER);
}
HDC dc = BeginPlatformPaint();
- BITMAPINFOHEADER hdr;
+ BITMAPINFOHEADER hdr = {0};
FillBitmapInfoHeader(src_size_x, src_size_y, &hdr);
if (is_translucent) {
// The image must be loaded as a bitmap inside a device context.