FIXME: comment out ppapi code that blocks compilation

This commit is contained in:
Heilig Benedek 2018-05-15 03:58:25 +02:00 committed by Samuel Attard
parent 60ba2013c4
commit 91d16c9b3a

View file

@ -193,95 +193,96 @@ int32_t PepperFlashRendererHost::OnSetInstanceAlwaysOnTop(
int32_t PepperFlashRendererHost::OnDrawGlyphs( int32_t PepperFlashRendererHost::OnDrawGlyphs(
ppapi::host::HostMessageContext* host_context, ppapi::host::HostMessageContext* host_context,
ppapi::proxy::PPBFlash_DrawGlyphs_Params params) { ppapi::proxy::PPBFlash_DrawGlyphs_Params params) {
if (params.glyph_indices.size() != params.glyph_advances.size() ||
params.glyph_indices.empty())
return PP_ERROR_FAILED; return PP_ERROR_FAILED;
// if (params.glyph_indices.size() != params.glyph_advances.size() ||
// Set up the typeface. // params.glyph_indices.empty())
int weight = (params.font_desc.weight + 1) * 100; // return PP_ERROR_FAILED;
SkFontStyle::Slant slant = SkFontStyle::kUpright_Slant; //
if (params.font_desc.italic) // // Set up the typeface.
slant = SkFontStyle::kItalic_Slant; // int weight = (params.font_desc.weight + 1) * 100;
SkFontStyle style(weight, SkFontStyle::kNormal_Width, slant); // SkFontStyle::Slant slant = SkFontStyle::kUpright_Slant;
sk_sp<SkTypeface> typeface( // if (params.font_desc.italic)
SkTypeface::MakeFromName(params.font_desc.face.c_str(), style)); // slant = SkFontStyle::kItalic_Slant;
if (!typeface) // SkFontStyle style(weight, SkFontStyle::kNormal_Width, slant);
return PP_ERROR_FAILED; // sk_sp<SkTypeface> typeface(
// SkTypeface::MakeFromName(params.font_desc.face.c_str(), style));
EnterResourceNoLock<PPB_ImageData_API> enter( // if (!typeface)
params.image_data.host_resource(), true); // return PP_ERROR_FAILED;
if (enter.failed()) //
return PP_ERROR_FAILED; // EnterResourceNoLock<PPB_ImageData_API> enter(
// params.image_data.host_resource(), true);
// Set up the canvas. // if (enter.failed())
PPB_ImageData_API* image = static_cast<PPB_ImageData_API*>(enter.object()); // return PP_ERROR_FAILED;
SkCanvas* canvas = image->GetCanvas(); //
bool needs_unmapping = false; // // Set up the canvas.
if (!canvas) { // PPB_ImageData_API* image = static_cast<PPB_ImageData_API*>(enter.object());
needs_unmapping = true; // SkCanvas* canvas = image->GetCanvas();
image->Map(); // bool needs_unmapping = false;
canvas = image->GetCanvas(); // if (!canvas) {
if (!canvas) // needs_unmapping = true;
return PP_ERROR_FAILED; // Failure mapping. // image->Map();
} // canvas = image->GetCanvas();
// if (!canvas)
SkAutoCanvasRestore acr(canvas, true); // return PP_ERROR_FAILED; // Failure mapping.
// }
// Clip is applied in pixels before the transform. //
SkRect clip_rect = { // SkAutoCanvasRestore acr(canvas, true);
SkIntToScalar(params.clip.point.x), SkIntToScalar(params.clip.point.y), //
SkIntToScalar(params.clip.point.x + params.clip.size.width), // // Clip is applied in pixels before the transform.
SkIntToScalar(params.clip.point.y + params.clip.size.height)}; // SkRect clip_rect = {
canvas->clipRect(clip_rect); // SkIntToScalar(params.clip.point.x), SkIntToScalar(params.clip.point.y),
// SkIntToScalar(params.clip.point.x + params.clip.size.width),
// Convert & set the matrix. // SkIntToScalar(params.clip.point.y + params.clip.size.height)};
SkMatrix matrix; // canvas->clipRect(clip_rect);
matrix.set(SkMatrix::kMScaleX, SkFloatToScalar(params.transformation[0][0])); //
matrix.set(SkMatrix::kMSkewX, SkFloatToScalar(params.transformation[0][1])); // // Convert & set the matrix.
matrix.set(SkMatrix::kMTransX, SkFloatToScalar(params.transformation[0][2])); // SkMatrix matrix;
matrix.set(SkMatrix::kMSkewY, SkFloatToScalar(params.transformation[1][0])); // matrix.set(SkMatrix::kMScaleX, SkFloatToScalar(params.transformation[0][0]));
matrix.set(SkMatrix::kMScaleY, SkFloatToScalar(params.transformation[1][1])); // matrix.set(SkMatrix::kMSkewX, SkFloatToScalar(params.transformation[0][1]));
matrix.set(SkMatrix::kMTransY, SkFloatToScalar(params.transformation[1][2])); // matrix.set(SkMatrix::kMTransX, SkFloatToScalar(params.transformation[0][2]));
matrix.set(SkMatrix::kMPersp0, SkFloatToScalar(params.transformation[2][0])); // matrix.set(SkMatrix::kMSkewY, SkFloatToScalar(params.transformation[1][0]));
matrix.set(SkMatrix::kMPersp1, SkFloatToScalar(params.transformation[2][1])); // matrix.set(SkMatrix::kMScaleY, SkFloatToScalar(params.transformation[1][1]));
matrix.set(SkMatrix::kMPersp2, SkFloatToScalar(params.transformation[2][2])); // matrix.set(SkMatrix::kMTransY, SkFloatToScalar(params.transformation[1][2]));
canvas->concat(matrix); // matrix.set(SkMatrix::kMPersp0, SkFloatToScalar(params.transformation[2][0]));
// matrix.set(SkMatrix::kMPersp1, SkFloatToScalar(params.transformation[2][1]));
SkPaint paint; // matrix.set(SkMatrix::kMPersp2, SkFloatToScalar(params.transformation[2][2]));
paint.setColor(params.color); // canvas->concat(matrix);
paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); //
paint.setAntiAlias(true); // SkPaint paint;
paint.setHinting(SkPaint::kFull_Hinting); // paint.setColor(params.color);
paint.setTextSize(SkIntToScalar(params.font_desc.size)); // paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
paint.setTypeface(std::move(typeface)); // paint.setAntiAlias(true);
if (params.allow_subpixel_aa) { // paint.setHinting(SkPaint::kFull_Hinting);
paint.setSubpixelText(true); // paint.setTextSize(SkIntToScalar(params.font_desc.size));
paint.setLCDRenderText(true); // paint.setTypeface(std::move(typeface));
} // if (params.allow_subpixel_aa) {
// paint.setSubpixelText(true);
SkScalar x = SkIntToScalar(params.position.x); // paint.setLCDRenderText(true);
SkScalar y = SkIntToScalar(params.position.y); // }
//
// Build up the skia advances. // SkScalar x = SkIntToScalar(params.position.x);
size_t glyph_count = params.glyph_indices.size(); // SkScalar y = SkIntToScalar(params.position.y);
if (glyph_count) { //
std::vector<SkPoint> storage; // // Build up the skia advances.
storage.resize(glyph_count); // size_t glyph_count = params.glyph_indices.size();
SkPoint* sk_positions = &storage[0]; // if (glyph_count) {
for (uint32_t i = 0; i < glyph_count; i++) { // std::vector<SkPoint> storage;
sk_positions[i].set(x, y); // storage.resize(glyph_count);
x += SkFloatToScalar(params.glyph_advances[i].x); // SkPoint* sk_positions = &storage[0];
y += SkFloatToScalar(params.glyph_advances[i].y); // for (uint32_t i = 0; i < glyph_count; i++) {
} // sk_positions[i].set(x, y);
// x += SkFloatToScalar(params.glyph_advances[i].x);
canvas->drawPosText(&params.glyph_indices[0], glyph_count * 2, sk_positions, // y += SkFloatToScalar(params.glyph_advances[i].y);
paint); // }
} //
// canvas->drawPosText(&params.glyph_indices[0], glyph_count * 2, sk_positions,
if (needs_unmapping) // paint);
image->Unmap(); // }
//
return PP_OK; // if (needs_unmapping)
// image->Unmap();
//
// return PP_OK;
} }
// CAUTION: This code is subtle because Navigate is a sync call which may // CAUTION: This code is subtle because Navigate is a sync call which may